• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP eZFile类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中eZFile的典型用法代码示例。如果您正苦于以下问题:PHP eZFile类的具体用法?PHP eZFile怎么用?PHP eZFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了eZFile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: handleFileDownload

 function handleFileDownload($contentObject, $contentObjectAttribute, $type, $fileInfo)
 {
     $fileName = $fileInfo['filepath'];
     $file = eZClusterFileHandler::instance($fileName);
     if ($fileName != "" and $file->exists()) {
         $fileSize = $file->size();
         if (isset($_SERVER['HTTP_RANGE']) && preg_match("/^bytes=(\\d+)-(\\d+)?\$/", trim($_SERVER['HTTP_RANGE']), $matches)) {
             $fileOffset = $matches[1];
             $contentLength = isset($matches[2]) ? $matches[2] - $matches[1] + 1 : $fileSize - $matches[1];
         } else {
             $fileOffset = 0;
             $contentLength = $fileSize;
         }
         // Figure out the time of last modification of the file right way to get the file mtime ... the
         $fileModificationTime = $file->mtime();
         // stop output buffering, and stop the session so that browsing can be continued while downloading
         eZSession::stop();
         ob_end_clean();
         eZFile::downloadHeaders($fileName, self::dispositionType($fileInfo['mime_type']) === 'attachment', false, $fileOffset, $contentLength, $fileSize);
         try {
             $file->passthrough($fileOffset, $contentLength);
         } catch (eZClusterFileHandlerNotFoundException $e) {
             eZDebug::writeError($e->getMessage, __METHOD__);
             header($_SERVER["SERVER_PROTOCOL"] . ' 500 Internal Server Error');
         } catch (eZClusterFileHandlerGeneralException $e) {
             eZDebug::writeError($e->getMessage, __METHOD__);
             header($_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found');
         }
         eZExecution::cleanExit();
     }
     return eZBinaryFileHandler::RESULT_UNAVAILABLE;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:32,代码来源:ezfilepassthroughhandler.php


示例2: sendMail

 function sendMail(eZMail $mail)
 {
     $ini = eZINI::instance();
     $sendmailOptions = '';
     $emailFrom = $mail->sender();
     $emailSender = $emailFrom['email'];
     if (!$emailSender || count($emailSender) <= 0) {
         $emailSender = $ini->variable('MailSettings', 'EmailSender');
     }
     if (!$emailSender) {
         $emailSender = $ini->variable('MailSettings', 'AdminEmail');
     }
     if (!eZMail::validate($emailSender)) {
         $emailSender = false;
     }
     $isSafeMode = ini_get('safe_mode');
     if ($isSafeMode and $emailSender and $mail->sender() == false) {
         $mail->setSenderText($emailSender);
     }
     $filename = time() . '-' . mt_rand() . '.mail';
     $data = preg_replace('/(\\r\\n|\\r|\\n)/', "\r\n", $mail->headerText() . "\n" . $mail->body());
     $returnedValue = eZFile::create($filename, 'var/log/mail', $data);
     if ($returnedValue === false) {
         eZDebug::writeError('An error occurred writing the e-mail file in var/log/mail', __METHOD__);
     }
     return $returnedValue;
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:27,代码来源:ezfiletransport.php


示例3: sendMail

 function sendMail(ezcMail $mail)
 {
     $separator = "/";
     $mail->appendExcludeHeaders(array('to', 'subject'));
     $headers = rtrim($mail->generateHeaders());
     // rtrim removes the linebreak at the end, mail doesn't want it.
     if (count($mail->to) + count($mail->cc) + count($mail->bcc) < 1) {
         throw new ezcMailTransportException('No recipient addresses found in message header.');
     }
     $additionalParameters = "";
     if (isset($mail->returnPath)) {
         $additionalParameters = "-f{$mail->returnPath->email}";
     }
     $sys = eZSys::instance();
     $fname = time() . '-' . rand() . '.mail';
     $qdir = eZSys::siteDir() . eZSys::varDirectory() . $separator . 'mailq';
     $data = $headers . ezcMailTools::lineBreak();
     $data .= ezcMailTools::lineBreak();
     $data .= $mail->generateBody();
     $data = preg_replace('/(\\r\\n|\\r|\\n)/', "\r\n", $data);
     $success = eZFile::create($fname, $qdir, $data);
     if ($success === false) {
         throw new ezcMailTransportException('The email could not be sent by sendmail');
     }
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:25,代码来源:eznewsletterfiletransport.php


示例4: synchronise

 public function synchronise(eZSolrBase $collection, $elevateXML, $params)
 {
     $uri_components = parse_url($collection->SearchServerURI);
     // The extra variables are used to avoid PHP strict warnings using end() directly on the preg_split result
     $pathElements = preg_split('/\\//', $uri_components['path']);
     $collectionName = end($pathElements);
     $filename = implode('__', array($uri_components['host'], $uri_components['port'], $collectionName, 'elevate.xml'));
     return eZFile::create($filename, $params['base_dir'], $elevateXML);
 }
开发者ID:kminds,项目名称:ezfind,代码行数:9,代码来源:ezfelevatesimplefilesync.php


示例5: testIssue16400

    /**
     * Regression test for issue 16400
     * @link http://issues.ez.no/16400
     * @return unknown_type
     */
    public function testIssue16400()
    {
        $className = 'Media test class';
        $classIdentifier = 'media_test_class';
        $filePath = 'tests/tests/kernel/datatypes/ezmedia/ezmediatype_regression_issue16400.flv';
        eZFile::create( $filePath );
        $attributeName = 'Media';
        $attributeIdentifier = 'media';
        $attributeType = 'ezmedia';
        //1. test method fetchByContentObjectID

        $class = new ezpClass( $className, $classIdentifier, $className );
        $class->add( $attributeName, $attributeIdentifier, $attributeType );
        $attribute = $class->class->fetchAttributeByIdentifier( $attributeIdentifier );

        $attribute->setAttribute( 'can_translate', 0 );
        $class->store();

        $object = new ezpObject( $classIdentifier, 2 );
        $dataMap = $object->object->dataMap();
        $fileAttribute = $dataMap[$attributeIdentifier];
        $dataType = new eZMediaType();
        $dataType->fromString( $fileAttribute, $filePath );

        $fileAttribute->store();
        $object->publish();
        $object->refresh();

        //verify fetchByContentObjectID
        $mediaObject = eZMedia::fetch( $fileAttribute->attribute( 'id' ), 1 );
        $medias = eZMedia::fetchByContentObjectID( $object->object->attribute( 'id' ) );
        $this->assertEquals( $mediaObject->attribute( 'filename' ), $medias[0]->attribute( 'filename' ) );
        $medias = eZMedia::fetchByContentObjectID( $object->object->attribute( 'id' ),
                                                    $fileAttribute->attribute( 'language_code' ) );
        $this->assertEquals( $mediaObject->attribute( 'filename' ), $medias[0]->attribute( 'filename' ) );

        //2. test issue
        // create translation
        $contentObject = $object->object;
        $storedFileName = $mediaObject->attribute( 'filename' );
        $version = $contentObject->createNewVersionIn( 'nor-NO',
                                                        $fileAttribute->attribute( 'language_code' )  );
        $version->setAttribute( 'status', eZContentObjectVersion::STATUS_INTERNAL_DRAFT );
        $version->store();
        $version->removeThis();
        $sys = eZSys::instance();
        $dir = $sys->storageDirectory();
        //verify the file is deleted
        $storedFilePath = $dir . '/original/video/' . $storedFileName;
        $file = eZClusterFileHandler::instance( $storedFilePath );
        $this->assertTrue( $file->exists( $storedFilePath ) );
        if ( $file->exists( $storedFilePath ) )
            unlink( $storedFilePath );
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:59,代码来源:ezmediatype_regression.php


示例6: __construct

 private function __construct()
 {
     $ini_varnish = eZINI::instance('mugo_varnish.ini');
     $this->debug = $ini_varnish->variable('VarnishSettings', 'DebugCurl') == 'enabled';
     $this->varnishServers = $ini_varnish->variable('VarnishSettings', 'VarnishServers');
     // override connection timeout
     if ($ini_varnish->variable('VarnishSettings', 'ConnectionTimeout') > -1) {
         $this->baseCurlOptions[CURLOPT_CONNECTTIMEOUT] = $ini_varnish->variable('VarnishSettings', 'ConnectionTimeout');
     }
     // make sure the log file exits
     if (!file_exists(self::CURL_DEBUG_OUTPUT_FILE)) {
         eZFile::create(self::CURL_DEBUG_OUTPUT_FILE);
     }
 }
开发者ID:yannschepens,项目名称:mugo_varnish,代码行数:14,代码来源:VarnishPurger.php


示例7: checkMD5Sums

 static function checkMD5Sums($file)
 {
     $lines = eZFile::splitLines($file);
     $result = array();
     if (is_array($lines)) {
         foreach (array_keys($lines) as $key) {
             $line =& $lines[$key];
             if (strlen($line) > 34) {
                 $md5Key = substr($line, 0, 32);
                 $filename = substr($line, 34);
                 if (!file_exists($filename) || $md5Key != md5_file($filename)) {
                     $result[] = $filename;
                 }
             }
         }
     }
     return $result;
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:18,代码来源:ezmd5.php


示例8: create

 static function create($filename, $directory = false, $data = false, $atomic = false)
 {
     $filepath = $filename;
     if ($directory) {
         if (!file_exists($directory)) {
             eZDir::mkdir($directory, false, true);
             //                 eZDebugSetting::writeNotice( 'ezfile-create', "Created directory $directory", 'eZFile::create' );
         }
         $filepath = $directory . '/' . $filename;
     }
     // If atomic creation is needed we will use a temporary
     // file when writing the data, then rename it to the correct path.
     if ($atomic) {
         $realpath = $filepath;
         $dirname = dirname($filepath);
         if (strlen($dirname) != 0) {
             $dirname .= "/";
         }
         $filepath = $dirname . "ezfile-tmp." . md5($filepath . getmypid() . mt_rand());
     }
     $file = fopen($filepath, 'wb');
     if ($file) {
         //             eZDebugSetting::writeNotice( 'ezfile-create', "Created file $filepath", 'eZFile::create' );
         if ($data) {
             if (is_resource($data)) {
                 // block-copy source $data to new $file in 1MB chunks
                 while (!feof($data)) {
                     fwrite($file, fread($data, 1048576));
                 }
                 fclose($data);
             } else {
                 fwrite($file, $data);
             }
         }
         fclose($file);
         if ($atomic) {
             // If the renaming process fails, delete the temporary file
             eZFile::rename($filepath, $realpath, false, eZFile::CLEAN_ON_FAILURE);
         }
         return true;
     }
     //         eZDebugSetting::writeNotice( 'ezfile-create', "Failed creating file $filepath", 'eZFile::create' );
     return false;
 }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:44,代码来源:ezfile.php


示例9: trashStoredObjectAttribute

 function trashStoredObjectAttribute($contentObjectAttribute, $version = null)
 {
     $contentObjectAttributeID = $contentObjectAttribute->attribute("id");
     $imageHandler = $contentObjectAttribute->attribute('content');
     $imageFiles = eZImageFile::fetchForContentObjectAttribute($contentObjectAttributeID);
     foreach ($imageFiles as $imageFile) {
         if ($imageFile == null) {
             continue;
         }
         $existingFilepath = $imageFile;
         // Check if there are any other records in ezimagefile that point to that filename.
         $imageObjectsWithSameFileName = eZImageFile::fetchByFilepath(false, $existingFilepath);
         $file = eZClusterFileHandler::instance($existingFilepath);
         if ($file->exists() and count($imageObjectsWithSameFileName) <= 1) {
             $orig_dir = dirname($existingFilepath) . '/trashed';
             $fileName = basename($existingFilepath);
             // create dest filename in the same manner as eZHTTPFile::store()
             // grab file's suffix
             $fileSuffix = eZFile::suffix($fileName);
             // prepend dot
             if ($fileSuffix) {
                 $fileSuffix = '.' . $fileSuffix;
             }
             // grab filename without suffix
             $fileBaseName = basename($fileName, $fileSuffix);
             // create dest filename
             $newFileBaseName = md5($fileBaseName . microtime() . mt_rand());
             $newFileName = $newFileBaseName . $fileSuffix;
             $newFilepath = $orig_dir . '/' . $newFileName;
             // rename the file, and update the database data
             $imageHandler->updateAliasPath($orig_dir, $newFileBaseName);
             if ($imageHandler->isStorageRequired()) {
                 $imageHandler->store($contentObjectAttribute);
                 $contentObjectAttribute->store();
             }
         }
     }
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:38,代码来源:ezimagetype.php


示例10: downloadFile

 /**
  * Downloads file.
  *
  * Sets $this->ErrorMsg in case of an error.
  *
  * \private
  * \param $url            URL.
  * \param $outDir         Directory where to put downloaded file to.
  * \param $forcedFileName Force saving downloaded file under this name.
  * \return false on error, path to downloaded package otherwise.
  */
 function downloadFile($url, $outDir, $forcedFileName = false)
 {
     $fileName = $outDir . "/" . ($forcedFileName ? $forcedFileName : basename($url));
     eZDebug::writeNotice("Downloading file '{$fileName}' from {$url}");
     // Create the out directory if not exists.
     if (!file_exists($outDir)) {
         eZDir::mkdir($outDir, false, true);
     }
     // First try CURL
     if (extension_loaded('curl')) {
         $ch = curl_init($url);
         $fp = eZStepSiteTypes::fopen($fileName, 'wb');
         if ($fp === false) {
             $this->ErrorMsg = ezpI18n::tr('design/standard/setup/init', 'Cannot write to file') . ': ' . $this->FileOpenErrorMsg;
             return false;
         }
         curl_setopt($ch, CURLOPT_FILE, $fp);
         curl_setopt($ch, CURLOPT_HEADER, 0);
         curl_setopt($ch, CURLOPT_FAILONERROR, 1);
         curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
         // Get proxy
         $ini = eZINI::instance();
         $proxy = $ini->hasVariable('ProxySettings', 'ProxyServer') ? $ini->variable('ProxySettings', 'ProxyServer') : false;
         if ($proxy) {
             curl_setopt($ch, CURLOPT_PROXY, $proxy);
             $userName = $ini->hasVariable('ProxySettings', 'User') ? $ini->variable('ProxySettings', 'User') : false;
             $password = $ini->hasVariable('ProxySettings', 'Password') ? $ini->variable('ProxySettings', 'Password') : false;
             if ($userName) {
                 curl_setopt($ch, CURLOPT_PROXYUSERPWD, "{$userName}:{$password}");
             }
         }
         if (!curl_exec($ch)) {
             $this->ErrorMsg = curl_error($ch);
             return false;
         }
         curl_close($ch);
         fclose($fp);
     } else {
         $parsedUrl = parse_url($url);
         $checkIP = isset($parsedUrl['host']) ? ip2long(gethostbyname($parsedUrl['host'])) : false;
         if ($checkIP === false) {
             return false;
         }
         // If we don't have CURL installed we used standard fopen urlwrappers
         // Note: Could be blocked by not allowing remote calls.
         if (!copy($url, $fileName)) {
             $buf = eZHTTPTool::sendHTTPRequest($url, 80, false, 'eZ Publish', false);
             $header = false;
             $body = false;
             if (eZHTTPTool::parseHTTPResponse($buf, $header, $body)) {
                 eZFile::create($fileName, false, $body);
             } else {
                 $this->ErrorMsg = ezpI18n::tr('design/standard/setup/init', 'Failed to copy %url to local file %filename', null, array("%url" => $url, "%filename" => $fileName));
                 return false;
             }
         }
     }
     return $fileName;
 }
开发者ID:nlenardou,项目名称:ezpublish,代码行数:70,代码来源:ezstep_site_types.php


示例11: saveCache

 /**
  * Stores the content of the INI object to the cache file \a $cachedFile.
  *
  * @param string $cachedDir Cache dir, usually "var/cache/ini/"
  * @param string $cachedFile Name of cache file as returned by cacheFileName()
  * @param array $data Configuration data as an associative array structure
  * @param array $inputFiles List of input files used as basis for cache (for use in load cache to check mtime)
  * @param string $iniFile Ini file path string returned by findInputFiles() for main ini file
  * @return bool
  */
 protected function saveCache($cachedDir, $cachedFile, array $data, array $inputFiles, $iniFile)
 {
     if (!file_exists($cachedDir)) {
         if (!eZDir::mkdir($cachedDir, 0777, true)) {
             eZDebug::writeError("Couldn't create cache directory {$cachedDir}, perhaps wrong permissions", __METHOD__);
             return false;
         }
     }
     // Save the data to a temp cached file
     $tmpCacheFile = $cachedFile . '_' . substr(md5(mt_rand()), 0, 8);
     $fp = @fopen($tmpCacheFile, "w");
     if ($fp === false) {
         eZDebug::writeError("Couldn't create cache file '{$cachedFile}', perhaps wrong permissions?", __METHOD__);
         return false;
     }
     // Write cache data as a php structure with some meta information for use while reading cache
     fwrite($fp, "<?php\n// This is a auto generated ini cache file, time created:" . date(DATE_RFC822) . "\n");
     fwrite($fp, "\$data = array(\n");
     fwrite($fp, "'rev' => " . eZINI::CONFIG_CACHE_REV . ",\n");
     fwrite($fp, "'created' => '" . date('c') . "',\n");
     if ($this->Codec) {
         fwrite($fp, "'charset' => \"" . $this->Codec->RequestedOutputCharsetCode . "\",\n");
     } else {
         fwrite($fp, "'charset' => \"{$this->Charset}\",\n");
     }
     fwrite($fp, "'files' => " . preg_replace("@\n[\\s]+@", '', var_export($inputFiles, true)) . ",\n");
     fwrite($fp, "'file' => '{$iniFile}',\n");
     fwrite($fp, "'val' => " . preg_replace("@\n[\\s]+@", '', var_export($data, true)) . ");");
     fwrite($fp, "\n?>");
     fclose($fp);
     // Rename cache temp file to final desitination and set permissions
     eZFile::rename($tmpCacheFile, $cachedFile);
     chmod($cachedFile, self::$filePermission);
     if (eZINI::isDebugEnabled()) {
         eZDebug::writeNotice("Wrote cache file '{$cachedFile}'", __METHOD__);
     }
     return true;
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:48,代码来源:ezini.php


示例12: storeCache

 /**
  * Stores the data in $fileData to the remote and local file and commits the
  * transaction.
  *
  * The parameter $fileData must contain the same as information as the
  * $generateCallback returns as explained in processCache().
  * @note This method is just a continuation of the code in processCache()
  *       and is not meant to be called alone since it relies on specific
  *       state in the database.
  */
 public function storeCache($fileData)
 {
     $scope = false;
     $datatype = false;
     $binaryData = null;
     $fileContent = null;
     $store = true;
     $storeCache = false;
     if (is_array($fileData)) {
         if (isset($fileData['scope'])) {
             $scope = $fileData['scope'];
         }
         if (isset($fileData['datatype'])) {
             $datatype = $fileData['datatype'];
         }
         if (isset($fileData['content'])) {
             $fileContent = $fileData['content'];
         }
         if (isset($fileData['binarydata'])) {
             $binaryData = $fileData['binarydata'];
         }
         if (isset($fileData['store'])) {
             $store = $fileData['store'];
         }
     } else {
         $binaryData = $fileData;
     }
     // This checks if we entered timeout and got our generating file stolen
     // If this happens, we don't store our cache
     if ($store and $this->checkCacheGenerationTimeout()) {
         $storeCache = true;
     }
     $result = null;
     if ($binaryData === null && $fileContent === null) {
         eZDebug::writeError("Write callback need to set the 'content' or 'binarydata' entry for '{$this->filePath}'", __METHOD__);
         $this->abortCacheGeneration();
         return null;
     }
     if ($binaryData === null) {
         $binaryData = "<" . "?php\n\treturn " . var_export($fileContent, true) . ";\n?" . ">\n";
     }
     if ($fileContent === null) {
         $result = $binaryData;
     } else {
         $result = $fileContent;
     }
     if (!$this->filePath) {
         return $result;
     }
     // no store advice from cache generation timeout or disabled viewcache,
     // we just return the result
     if (!$storeCache) {
         eZDebugSetting::writeDebug('kernel-clustering', "Not storing this cache", __METHOD__);
         $this->abortCacheGeneration();
         return $result;
     }
     // stale cache handling: we just return the result, no lock has been set
     if ($this->useStaleCache) {
         eZDebugSetting::writeDebug('kernel-clustering', "Stalecache mode enabled for this cache", "dfs::storeCache( {$this->filePath} )");
         // we write the generated cache to disk if it does not exist yet,
         // to speed up the next uncached operation
         // This file will be overwritten by the real file
         clearstatcache();
         if (!file_exists($this->filePath)) {
             eZDebugSetting::writeDebug('kernel-clustering', "Writing stale file content to local file {$this->filePath}", __METHOD__);
             eZFile::create(basename($this->filePath), dirname($this->filePath), $binaryData, true);
         }
         return $result;
     }
     // Check if we are allowed to store the data, if not just return the result
     if (!$store) {
         $this->abortCacheGeneration();
         return $result;
     }
     // Distinguish bool from eZClusterFileFailure, and call abortCacheGeneration()
     $storeContentsResult = $this->storeContents($binaryData, $scope, $datatype, $storeLocally = false);
     // Cache was stored, we end cache generation
     if ($storeContentsResult === true) {
         $this->endCacheGeneration();
     } else {
         if ($storeContentsResult instanceof eZMySQLBackendError) {
             $this->abortCacheGeneration();
         }
     }
     // We don't do anything if false (not stored for known reasons) has been returned
     return $result;
 }
开发者ID:CG77,项目名称:ezpublish-legacy,代码行数:97,代码来源:ezdfsfilehandler.php


示例13: create

 static function create($filename, $directory = false, $data = false, $atomic = false)
 {
     $filepath = $filename;
     if ($directory) {
         if (!file_exists($directory)) {
             eZDir::mkdir($directory, false, true);
             //                 eZDebugSetting::writeNotice( 'ezfile-create', "Created directory $directory", 'eZFile::create' );
         }
         $filepath = $directory . '/' . $filename;
     }
     // If atomic creation is needed we will use a temporary
     // file when writing the data, then rename it to the correct path.
     if ($atomic) {
         $realpath = $filepath;
         $dirname = dirname($filepath);
         if (strlen($dirname) != 0) {
             $dirname .= "/";
         }
         $filepath = $dirname . "ezfile-tmp." . md5($filepath . getmypid() . mt_rand());
     }
     $file = fopen($filepath, 'wb');
     if ($file) {
         //             eZDebugSetting::writeNotice( 'ezfile-create', "Created file $filepath", 'eZFile::create' );
         if ($data) {
             fwrite($file, $data);
         }
         fclose($file);
         if ($atomic) {
             eZFile::rename($filepath, $realpath);
         }
         return true;
     }
     //         eZDebugSetting::writeNotice( 'ezfile-create', "Failed creating file $filepath", 'eZFile::create' );
     return false;
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:35,代码来源:ezfile.php


示例14: eZSetupPrvtAreDirAndFilesWritable

function eZSetupPrvtAreDirAndFilesWritable($dir)
{
    if (!eZDir::isWriteable($dir)) {
        return FALSE;
    }
    // Check if all files within a given directory are writeable
    $files = eZDir::findSubitems($dir, 'f');
    // find only files, skip dirs and symlinks
    $fileSeparator = eZSys::fileSeparator();
    foreach ($files as $file) {
        if (!eZFile::isWriteable($dir . $fileSeparator . $file)) {
            return FALSE;
        }
    }
    return TRUE;
}
开发者ID:runelangseid,项目名称:ezpublish,代码行数:16,代码来源:ezsetuptests.php


示例15: close

 function close()
 {
     if ($this->ClusteringEnabled) {
         $this->ClusterHandler = null;
         return;
     }
     if ($this->FileResource) {
         fclose($this->FileResource);
         if ($this->isAtomic) {
             eZFile::rename($this->tmpFilename, $this->requestedFilename);
         }
         $this->FileResource = false;
     }
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:14,代码来源:ezphpcreator.php


示例16: renameDir

    static function renameDir( $dir )
    {
        // just rename. Actual removing will be performed by cronjob.

        // This directory renaming is only performed on the local filesystem
        // to ensure purging of really old data. If the DB file handler is in
        // use it will check the modified_subnode field of the tree structure
        // to determin expiry when the cache-block entry is accessed.
        if ( file_exists( $dir ) )
        {
            if ( is_dir( $dir ) )
            {
                $expiryCacheDir = eZTemplateCacheFunction::expiryTemplateBlockCacheDir();

                $uniqid = md5( uniqid( 'ezpsubtreecache'. getmypid(), true ) );
                $expiryCacheDir .= '/' . $uniqid[0] . '/' . $uniqid[1] . '/' . $uniqid[2] . '/' . $uniqid;

                if ( !file_exists( $expiryCacheDir ) )
                {
                    eZDir::mkdir( $expiryCacheDir, false, true );
                }
                eZFile::rename( $dir, $expiryCacheDir, false, eZFile::APPEND_DEBUG_ON_FAILURE );
            }
            else
            {
                eZDebug::writeWarning( "$dir should be a directory. Template-block caches for 'subtree_expiry' are not removed.", __METHOD__ );
            }
        }
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:29,代码来源:ezsubtreecache.php


示例17: doRename

 static function doRename( $destinationFilename, $sourceFilename )
 {
     return eZFile::rename( $sourceFilename, $destinationFilename );
 }
开发者ID:nottavi,项目名称:ezpublish,代码行数:4,代码来源:ezfilehandler.php


示例18: createFile

 protected function createFile($filePath, $contents, $atomic = true)
 {
     // $contents can result from a failed file_get_contents(). In this case
     if ($contents === false) {
         return false;
     }
     $createResult = eZFile::create(basename($filePath), dirname($filePath), $contents, $atomic);
     if ($createResult) {
         $this->fixPermissions($filePath);
     }
     return $createResult;
 }
开发者ID:schwabokaner,项目名称:ezpublish-legacy,代码行数:12,代码来源:dfs.php


示例19: storeMessageToFilesystem

 /**
  * store mailitem on filesystem
  *
  * @todo eZFile::create result
  * @return void
  */
 private function storeMessageToFilesystem()
 {
     $mailboxItemId = $this->attribute('id');
     $mailboxId = $this->attribute('mailbox_id');
     $messageId = $this->attribute('message_id');
     $currentTimestamp = time();
     // return filepath
     $filePathArray = $this->getFilePathArray();
     // return content string of mail item
     $messageData = $this->MessageString;
     // create file in path with content
     $createResult = eZFile::create($filePathArray['file_name'], $filePathArray['file_dir'], $messageData);
 }
开发者ID:heliopsis,项目名称:cjw_newsletter,代码行数:19,代码来源:cjwnewslettermailboxitem.php


示例20: array

$script->startup();
$options = $script->getOptions('', '', array());
$script->initialize();
$limit = 20;
$offset = 0;
$db = eZDB::instance();
$script->setIterationData('.', '~');
while ($binaryFiles = eZPersistentObject::fetchObjectList(eZBinaryFile::definition(), null, null, null, array('offset' => $offset, 'limit' => $limit))) {
    foreach ($binaryFiles as $binaryFile) {
        $fileName = $binaryFile->attribute('filename');
        if (strpos($fileName, '.') !== false) {
            $text = "skipping {$fileName}, it contains a suffix";
            $script->iterate($cli, true, $text);
            continue;
        }
        $suffix = eZFile::suffix($binaryFile->attribute('original_filename'));
        if ($suffix) {
            $newFileName = $fileName . '.' . $suffix;
            $db->begin();
            $oldFilePath = $binaryFile->attribute('filepath');
            $binaryFile->setAttribute('filename', $newFileName);
            $binaryFile->store();
            $newFilePath = $binaryFile->attribute('filepath');
            $file = eZClusterFileHandler::instance($oldFilePath);
            if ($file->exists()) {
                $text = "renamed {$fileName} to {$newFileName}";
                $file->move($newFilePath);
            } else {
                $text = "file not found: {$oldFilePath}";
                $script->iterate($cli, false, $text);
                $db->rollback();
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:31,代码来源:updatebinaryfile.php



注:本文中的eZFile类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP eZFileHandler类代码示例发布时间:2022-05-23
下一篇:
PHP eZExtension类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap