本文整理汇总了PHP中eZSys::storageDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP eZSys::storageDirectory方法的具体用法?PHP eZSys::storageDirectory怎么用?PHP eZSys::storageDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZSys
的用法示例。
在下文中一共展示了eZSys::storageDirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPHPCreatorInstance
/**
* @deprecated since 2.1
* Get instance of PHPCreator to use for storing and loading
* look up table.
*
* @return eZPHPCreator return instance of eZPHPCreator
* @todo Refactor with ezcPhpGenerator
* http://ezcomponents.org/docs/api/trunk/classtrees_PhpGenerator.html
*/
protected function getPHPCreatorInstance()
{
if (empty(self::$PHPCreator)) {
self::$PHPCreator = new eZPHPCreator(eZDIR::path(array(eZSys::storageDirectory(), ezfSolrDocumentFieldName::LOOKUP_FILEDIR)), ezfSolrDocumentFieldName::LOOKUP_FILENAME);
}
return self::$PHPCreator;
}
示例2: filePathForBinaryFile
function filePathForBinaryFile($fileName, $mimeType)
{
$storageDir = eZSys::storageDirectory();
list($group, $type) = explode('/', $mimeType);
$filePath = $storageDir . '/original/' . $group . '/' . $fileName;
return $filePath;
}
示例3: eZSurveyFile
function eZSurveyFile($row = false)
{
$bfsf_ini = eZINI::instance('bfsurveyfile.ini');
$varPath = eZSys::storageDirectory();
$survey_object_id = 0;
//get survey object (lookup object ID, as the survey_id changes with each edit)
$survey = new eZSurveyType();
$surveyObject = $survey->fetchSurveyByID($row['survey_id']);
if ($surveyObject) {
$survey_object_id = $surveyObject->attribute('contentobject_id');
}
//set directory paths
$surveyUploadDir = self::UPLOAD_DIR_BASE . '/' . self::UPLOAD_DIR_PREFIX . $survey_object_id . '/';
// syntax example: surveryfiles/survey_123/
$this->uploadPath = $varPath . '/' . $surveyUploadDir;
//create directory if NOT exists
if (!is_dir($this->uploadPath)) {
mkdir($this->uploadPath, 0777, true);
}
//TODO: error if directory cannot be created
//set allowed file extensions
$allowedExtensions = $bfsf_ini->variable('SurveyFile', 'AllowedExtensions');
if (isset($allowedExtensions)) {
$this->allowedExtensions = $allowedExtensions;
}
//set max file size
$sizeLimit = $bfsf_ini->variable('SurveyFile', 'MaxFileSize');
$row['type'] = 'File';
if (!isset($row['mandatory'])) {
$row['mandatory'] = 0;
}
$this->eZSurveyQuestion($row);
}
示例4: store
function store($sub_dir = false, $suffix = false, $mimeData = false)
{
if (!$this->IsTemporary) {
eZDebug::writeError("Cannot store non temporary file: " . $this->Filename, "eZHTTPFile");
return false;
}
$this->IsTemporary = false;
$ini = eZINI::instance();
// $storage_dir = $ini->variable( "FileSettings", "VarDir" ) . '/' . $ini->variable( "FileSettings", "StorageDir" );
$storage_dir = eZSys::storageDirectory();
if ($sub_dir !== false) {
$dir = $storage_dir . "/{$sub_dir}/";
} else {
$dir = $storage_dir . "/";
}
if ($mimeData) {
$dir = $mimeData['dirpath'];
}
if (!$mimeData) {
$dir .= $this->MimeCategory;
}
if (!file_exists($dir)) {
if (!eZDir::mkdir($dir, false, true)) {
return false;
}
}
$suffixString = false;
if ($suffix != false) {
$suffixString = ".{$suffix}";
}
if ($mimeData) {
$dest_name = $mimeData['url'];
} else {
$dest_name = $dir . "/" . md5(basename($this->Filename) . microtime() . mt_rand()) . $suffixString;
}
if (!move_uploaded_file($this->Filename, $dest_name)) {
eZDebug::writeError("Failed moving uploaded file " . $this->Filename . " to destination {$dest_name}");
unlink($dest_name);
$ret = false;
} else {
$ret = true;
$this->Filename = $dest_name;
$perm = $ini->variable("FileSettings", "StorageFilePermissions");
$oldumask = umask(0);
chmod($dest_name, octdec($perm));
umask($oldumask);
// Write log message to storage.log
$storageDir = $dir . "/";
eZLog::writeStorageLog(basename($this->Filename), $storageDir);
}
return $ret;
}
示例5: copyBrightcovefilesTODB
function copyBrightcovefilesTODB($remove)
{
global $cli, $fileHandler;
$db = eZDB::instance();
$cli->output("Importing brightcove files to database:");
$rows = $db->arrayQuery('select file_path, file_name, mime_type from ezbrightcove_data');
foreach ($rows as $row) {
$filePath = eZSys::storageDirectory() . "/" . $row['file_path'] . "/" . $row['file_name'];
$cli->output("- " . $filePath);
$fileHandler->fileStore($filePath, 'brightcove', $remove);
}
$cli->output();
}
示例6: unserializeContentObjectAttribute
function unserializeContentObjectAttribute( $package, $objectAttribute, $attributeNode )
{
$fileNode = $attributeNode->getElementsByTagName( 'binary-file' )->item( 0 );
if ( !is_object( $fileNode ) or !$fileNode->hasAttributes() )
{
return;
}
$binaryFile = eZBinaryFile::create( $objectAttribute->attribute( 'id' ), $objectAttribute->attribute( 'version' ) );
$sourcePath = $package->simpleFilePath( $fileNode->getAttribute( 'filekey' ) );
if ( !file_exists( $sourcePath ) )
{
eZDebug::writeError( "The file '$sourcePath' does not exist, cannot initialize file attribute with it", __METHOD__ );
return false;
}
$ini = eZINI::instance();
$mimeType = $fileNode->getAttribute( 'mime-type' );
list( $mimeTypeCategory, $mimeTypeName ) = explode( '/', $mimeType );
$destinationPath = eZSys::storageDirectory() . '/original/' . $mimeTypeCategory . '/';
if ( !file_exists( $destinationPath ) )
{
$oldumask = umask( 0 );
if ( !eZDir::mkdir( $destinationPath, false, true ) )
{
umask( $oldumask );
return false;
}
umask( $oldumask );
}
$basename = basename( $fileNode->getAttribute( 'filename' ) );
while ( file_exists( $destinationPath . $basename ) )
{
$basename = substr( md5( mt_rand() ), 0, 8 ) . '.' . eZFile::suffix( $fileNode->getAttribute( 'filename' ) );
}
eZFileHandler::copy( $sourcePath, $destinationPath . $basename );
eZDebug::writeNotice( 'Copied: ' . $sourcePath . ' to: ' . $destinationPath . $basename, __METHOD__ );
$binaryFile->setAttribute( 'contentobject_attribute_id', $objectAttribute->attribute( 'id' ) );
$binaryFile->setAttribute( 'filename', $basename );
$binaryFile->setAttribute( 'original_filename', $fileNode->getAttribute( 'original-filename' ) );
$binaryFile->setAttribute( 'mime_type', $fileNode->getAttribute( 'mime-type' ) );
$binaryFile->store();
$fileHandler = eZClusterFileHandler::instance();
$fileHandler->fileStore( $destinationPath . $basename, 'binaryfile', true );
}
示例7: mkdir
$prio = $manualPriority[$mKey];
} else {
$prio = null;
}
if (isset($manualFrequency[$mKey])) {
$freq = $manualFrequency[$mKey];
} else {
$freq = null;
}
$sitemap->add($url, null, $freq, $prio);
if (isset($bar)) {
$bar->advance();
}
}
// write XML Sitemap to file
$dir = eZSys::storageDirectory() . '/sitemap';
if (!file_exists($dir)) {
mkdir($dir, 0777, true);
}
$filename = $dir . '/' . $language['siteaccess'] . '_' . xrowGoogleSiteMap::BASENAME . '.' . xrowGoogleSiteMap::SUFFIX;
$sitemap->save($filename);
if (function_exists('gzencode') and $googlesitemapsINI->variable('SiteMapSettings', 'Gzip') == 'enabled') {
$content = file_get_contents($filename);
$content = gzencode($content);
file_put_contents($filename . '.gz', $content);
unlink($filename);
$filename .= '.gz';
}
if (!$isQuiet) {
$cli->output();
$cli->output("Sitemap {$filename} for siteaccess " . $language['siteaccess'] . " (language code " . $language['locale'] . ") has been generated!\n\n");
示例8: createMFSitemap
//.........这里部分代码省略.........
// Fetch the content tree
$params = array('SortBy' => array(array('depth', true), array('published', false)));
if (isset($params2)) {
$params = array_merge($params, $params2);
}
$subtreeCount = eZContentObjectTreeNode::subTreeCountByNodeID($params, $rootNode->NodeID);
if ($subtreeCount == 1) {
$cli->output("No Items found under node #" . $contentINI->variable('NodeSettings', 'RootNode') . ".");
}
if (!$isQuiet) {
$amount = $subtreeCount + 1;
// +1 is root node
$cli->output("Adding {$amount} nodes to the sitemap.");
$output = new ezcConsoleOutput();
$bar = new ezcConsoleProgressbar($output, $amount);
}
$addPrio = false;
if ($googlesitemapsINI->hasVariable('MFSitemapSettings', 'AddPriorityToSubtree') and $googlesitemapsINI->variable('MFSitemapSettings', 'AddPriorityToSubtree') == 'true') {
$addPrio = true;
}
$sitemap = new xrowSitemap();
// Generate Sitemap
/** START Adding the root node **/
$object = $rootNode->object();
$meta = xrowMetaDataFunctions::fetchByObject($object);
$extensions = array();
$extensions[] = new xrowSitemapItemModified($rootNode->attribute('modified_subnode'));
$url = $rootNode->attribute('url_alias');
eZURI::transformURI($url, true);
if ($ini->variable('SiteAccessSettings', 'RemoveSiteAccessIfDefaultAccess') == 'enabled') {
$url = 'http://' . xrowSitemapTools::domain() . $url;
} else {
$url = 'http://' . xrowSitemapTools::domain() . '/' . $GLOBALS['eZCurrentAccess']['name'] . $url;
}
if ($meta and $meta->googlemap != '0') {
$extensions[] = new xrowSitemapItemFrequency($meta->change);
$extensions[] = new xrowSitemapItemPriority($meta->priority);
$sitemap->add($url, $extensions);
} elseif ($meta === false and $googlesitemapsINI->variable('Settings', 'AlwaysAdd') == 'enabled') {
if ($addPrio) {
$extensions[] = new xrowSitemapItemPriority('1');
}
$sitemap->add($url, $extensions);
}
if (isset($bar)) {
$bar->advance();
}
/** END Adding the root node **/
$max = min($max, $subtreeCount);
$params['Limit'] = min($max, $limit);
$params['Offset'] = 0;
while ($params['Offset'] < $max) {
$nodeArray = eZContentObjectTreeNode::subTreeByNodeID($params, $rootNode->NodeID);
foreach ($nodeArray as $subTreeNode) {
eZContentLanguage::expireCache();
$object = $subTreeNode->object();
$images = array();
$meta = xrowMetaDataFunctions::fetchByObject($object);
$extensions = array();
$extensions[] = new xrowSitemapItemModified($subTreeNode->attribute('modified_subnode'));
$url = $subTreeNode->attribute('url_alias');
eZURI::transformURI($url, true);
if ($ini->variable('SiteAccessSettings', 'RemoveSiteAccessIfDefaultAccess') == 'enabled') {
$url = 'http://' . xrowSitemapTools::domain() . $url;
} else {
$url = 'http://' . xrowSitemapTools::domain() . '/' . $GLOBALS['eZCurrentAccess']['name'] . $url;
}
if ($meta and $meta->googlemap != '0') {
$extensions[] = new xrowSitemapItemFrequency($meta->change);
$extensions[] = new xrowSitemapItemPriority($meta->priority);
} elseif ($meta === false and $googlesitemapsINI->variable('Settings', 'AlwaysAdd') == 'enabled') {
if ($addPrio) {
$rootDepth = $rootNode->attribute('depth');
$prio = 1 - ($subTreeNode->attribute('depth') - $rootDepth) / 10;
if ($prio > 0) {
$extensions[] = new xrowSitemapItemPriority($prio);
}
}
}
$images = self::getSitemapImageItems($object);
$sitemap->add($url, array_merge($extensions, $images));
if (isset($bar)) {
$bar->advance();
}
}
eZContentObject::clearCache();
$params['Offset'] += $params['Limit'];
}
// write XML Sitemap to file
$dir = eZSys::storageDirectory() . '/sitemap/' . xrowSitemapTools::domain();
if (!is_dir($dir)) {
mkdir($dir, 0777, true);
}
$filename = $dir . '/' . xrowSitemap::BASENAME . '_standard_' . $GLOBALS['eZCurrentAccess']['name'] . '.' . xrowSitemap::SUFFIX;
$sitemap->save($filename);
if (!$isQuiet) {
$cli->output("\n");
$cli->output("Sitemap {$filename} for siteaccess " . $GLOBALS['eZCurrentAccess']['name'] . " has been generated.\n");
}
}
示例9: array
<?php
/**
*
* @author G. Giunta
* @copyright (C) G. Giunta 2008-2016
* @license Licensed under GNU General Public License v2.0. See file license.txt
*
* @todo add more details, such as dates of first/last files
* @todo add support for db-clustered configs - hard currently, since there is no recursive search in api...
* @todo in edfs mode allow user to only show clustered data
*/
$storageFilesList = array();
$storageDir = eZSys::storageDirectory();
$files = @scandir($storageDir);
foreach ($files as $file) {
if ($file != '.' && $file != '..' && is_dir($storageDir . '/' . $file)) {
$storageFilesList[$file] = array('path' => $storageDir . '/' . $file, 'count' => number_format(sysInfoTools::countFilesInDir($storageDir . '/' . $file)), 'size' => number_format(sysInfoTools::countFilesSizeInDir($storageDir . '/' . $file)));
}
}
if ($Params['viewmode'] == 'json') {
$response_type = $Params['viewmode'];
$response_data = $storageFilesList;
return;
}
$tpl->setVariable('filelist', $storageFilesList);
示例10: storedFilename
function storedFilename(&$binary, $returnMimeData = false)
{
$origDir = eZSys::storageDirectory() . '/original';
$class = get_class($binary);
$fileName = false;
$originalFilename = false;
if (in_array($class, array('eZBinaryFile', 'eZMedia'))) {
$fileName = $origDir . "/" . $binary->attribute('mime_type_category') . '/' . $binary->attribute("filename");
$originalFilename = $binary->attribute('original_filename');
} else {
if ($class == 'eZImageAliasHandler') {
$alias = $binary->attribute('original');
if ($alias) {
$fileName = $alias['url'];
}
$originalFilename = $binary->attribute('original_filename');
}
}
if ($fileName) {
$mimeData = eZMimeType::findByFileContents($fileName);
$mimeData['original_filename'] = $originalFilename;
if (!isset($mimeData['name'])) {
$mimeData['name'] = 'application/octet-stream';
}
if ($returnMimeData) {
return $mimeData;
} else {
return $mimeData['url'];
}
}
return false;
}
示例11: unserializeContentObjectAttribute
function unserializeContentObjectAttribute($package, $objectAttribute, $attributeNode)
{
$mediaNode = $attributeNode->getElementsByTagName('media-file')->item(0);
if (!$mediaNode) {
// No media type data found.
return;
}
$mediaFile = eZMedia::create($objectAttribute->attribute('id'), $objectAttribute->attribute('version'));
$sourcePath = $package->simpleFilePath($mediaNode->getAttribute('filekey'));
$ini = eZINI::instance();
$mimeType = $mediaNode->getAttribute('mime-type');
list($mimeTypeCategory, $mimeTypeName) = explode('/', $mimeType);
$destinationPath = eZSys::storageDirectory() . '/original/' . $mimeTypeCategory . '/';
if (!file_exists($destinationPath)) {
if (!eZDir::mkdir($destinationPath, false, true)) {
return false;
}
}
$basename = basename($mediaNode->getAttribute('filename'));
while (file_exists($destinationPath . $basename)) {
$basename = substr(md5(mt_rand()), 0, 8) . '.' . eZFile::suffix($mediaNode->getAttribute('filename'));
}
eZFileHandler::copy($sourcePath, $destinationPath . $basename);
eZDebug::writeNotice('Copied: ' . $sourcePath . ' to: ' . $destinationPath . $basename, __METHOD__);
$mediaFile->setAttribute('contentobject_attribute_id', $objectAttribute->attribute('id'));
$mediaFile->setAttribute('filename', $basename);
$mediaFile->setAttribute('original_filename', $mediaNode->getAttribute('original-filename'));
$mediaFile->setAttribute('mime_type', $mediaNode->getAttribute('mime-type'));
$mediaFile->setAttribute('width', $mediaNode->getAttribute('width'));
$mediaFile->setAttribute('height', $mediaNode->getAttribute('height'));
$mediaFile->setAttribute('has_controller', $mediaNode->getAttribute('has-controller'));
$mediaFile->setAttribute('controls', $mediaNode->getAttribute('controls'));
$mediaFile->setAttribute('is_autoplay', $mediaNode->getAttribute('is-autoplay'));
$mediaFile->setAttribute('pluginspage', $mediaNode->getAttribute('plugins-page'));
$mediaFile->setAttribute('quality', $mediaNode->getAttribute('quality'));
$mediaFile->setAttribute('is_loop', $mediaNode->getAttribute('is-loop'));
$fileHandler = eZClusterFileHandler::instance();
$fileHandler->fileStore($destinationPath . $basename, 'mediafile', true);
$mediaFile->store();
}
示例12: count
$sitemap_index = '<?xml version="1.0" encoding="UTF-8"?>';
$sitemap_index .= '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
$limit = 40000;
$offset = 0;
$sql_count = "SELECT count(*) FROM do_sitemap ";
$sitemap_number = 1;
while ($offset < $count) {
$sitemap_file_name = 'sitemap_' . $sitemap_number . '.xml';
$sql = "SELECT dosm_loc , dosm_lastmod , dosm_priority , dosm_changefreq FROM do_sitemap LIMIT {$offset} , {$limit} ";
$results = $db->arrayQuery($sql);
$sm = '<?xml version="1.0" encoding="UTF-8"?>';
$sm .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
foreach ($results as $result) {
$sm .= '<url>';
$sm .= '<loc>' . $result['dosm_loc'] . '</loc>';
$sm .= '<lastmod>' . $result['dosm_lastmod'] . '</lastmod>';
$sm .= '<changefreq>' . $result['dosm_changefreq'] . '</changefreq>';
$sm .= '<priority>' . $result['dosm_priority'] . '</priority>';
$sm .= '</url>';
}
$sm .= '</urlset>';
eZFile::create($sitemap_file_name, eZSys::storageDirectory() . '/images/do_sitemap/', $sm);
$sitemap_index .= '<sitemap>';
$sitemap_index .= '<loc>' . $siteURL . '/' . eZSys::storageDirectory() . '/images/do_sitemap/' . $sitemap_file_name . '</loc>';
$sitemap_index .= '</sitemap>';
$offset = $offset + $limit;
$sitemap_number++;
}
$sitemap_index .= '</sitemapindex>';
eZFile::create('sitemap.xml', eZSys::storageDirectory() . '/images/do_sitemap/', $sitemap_index);
示例13: getFile
/**
* @param string $logoField
* @return string
*/
public function getFile( $logoField )
{
if( $this->attribute( $logoField ) != null && $this->attribute( $logoField ) != '' )
{
$storageDir = eZSys::storageDirectory();
$clusterIdentifier = ClusterTool::clusterIdentifier();
$publisherFolderPath = $this->publisherFolder['path'];
$outputDirectory = "{$storageDir}/static-data/{$clusterIdentifier}/publisher_folders/{$publisherFolderPath}";
if (!is_readable($outputDirectory) || !is_dir($outputDirectory))
{
mkdir($outputDirectory, 0777, true);
}
$outputFile = "{$outputDirectory}/{$logoField}.png";
$fileUtils = eZClusterFileHandler::instance( $outputFile );
if( !$fileUtils->fileExists( $outputFile ) )
{
if ( $fileUtils->requiresClusterizing() )
{
eZDFSFileHandler::fileStoreContents( $outputFile, $this->attribute( $logoField ) );
}
else
{
file_put_contents( $outputFile, $this->attribute( $logoField ) );
}
}
return '/' . $outputFile;
}
else
{
return null;
}
}
示例14: array
} else {
$siteAccessArray = array($ini->variable('SiteSettings', 'DefaultAccess'));
}
// adding the mobile sitemap site accesses
if ($xrowsitemapINI->hasVariable('MobileSitemapSettings', 'AvailableSiteAccessList')) {
$siteAccessArray = array_merge($siteAccessArray, $xrowsitemapINI->variable('MobileSitemapSettings', 'AvailableSiteAccessList'));
}
$Module = $Params['Module'];
$access = $GLOBALS['eZCurrentAccess']['name'];
if (is_array($siteAccessArray) && count($siteAccessArray) > 0) {
if (!in_array($access, $siteAccessArray)) {
return $Module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
}
}
$index = new xrowSitemapIndex();
$dirArray = array(eZSys::storageDirectory() . '/sitemap/' . xrowSitemapTools::domain(), eZSys::storageDirectory() . '/sitemap/' . xrowSitemapTools::domain() . '/' . xrowSitemapTools::FILETYP_ARCHIVE, eZSys::storageDirectory() . '/sitemap/' . xrowSitemapTools::domain() . '/' . xrowSitemapTools::FILETYP_STANDARD);
foreach ($dirArray as $item) {
addFiles($index, $item, $dirArray);
}
function addFiles(&$index, $dirname, $dirArray)
{
try {
$dir = new eZClusterDirectoryIterator($dirname);
} catch (Exception $e) {
if ($e instanceof UnexpectedValueException) {
eZDebug::writeDebug("Cannot add {$dirname} to the sitemaps index because it does not exist");
return;
}
}
foreach ($dir as $file) {
$f = eZClusterFileHandler::instance($file->name());
示例15: createMobileSitemap
//.........这里部分代码省略.........
if ($subtreeCount == 1) {
$cli->output("No Items found under RootNode {$rootNode->NodeID}.");
}
if (!$isQuiet) {
$amount = $subtreeCount + 1;
// +1 is root node
$cli->output("Adding {$amount} nodes to the sitemap for RootNode {$rootNode->NodeID}.");
$output = new ezcConsoleOutput();
$bar = new ezcConsoleProgressbar($output, $amount);
}
$addPrio = false;
if ($xrowsitemapINI->hasVariable('Settings', 'AddPriorityToSubtree') and $xrowsitemapINI->variable('Settings', 'AddPriorityToSubtree') == 'true') {
$addPrio = true;
}
$sitemap = new xrowMobileSitemap();
// Generate Sitemap
/** START Adding the root node **/
$object = $rootNode->object();
$meta = xrowMetaDataFunctions::fetchByObject($object);
$extensions = array();
$extensions[] = new xrowSitemapItemModified($rootNode->attribute('modified_subnode'));
$url = $rootNode->attribute('url_alias');
eZURI::transformURI($url);
if ($xrowsitemapINI->hasVariable('SitemapSettings', 'MobileDomainName') && $xrowsitemapINI->hasVariable('SitemapSettings', 'MobileDomainName') != '') {
$mobileDomain = $xrowsitemapINI->variable('SitemapSettings', 'MobileDomainName');
} else {
$mobileDomain = self::domain();
}
$url = 'http://' . $mobileDomain . $url;
if ($meta and $meta->sitemap_use != '0') {
$extensions[] = new xrowSitemapItemFrequency($meta->change);
$extensions[] = new xrowSitemapItemPriority($meta->priority);
$sitemap->add($url, $extensions);
} elseif ($meta === false and $xrowsitemapINI->variable('Settings', 'AlwaysAdd') == 'enabled') {
if ($addPrio) {
$extensions[] = new xrowSitemapItemPriority('1');
}
$sitemap->add($url, $extensions);
}
if (isset($bar)) {
$bar->advance();
}
/** END Adding the root node **/
$max = min($max, $subtreeCount);
$params['Limit'] = min($max, $limit);
$params['Offset'] = 0;
while ($params['Offset'] < $max) {
$nodeArray = eZContentObjectTreeNode::subTreeByNodeID($params, $rootNode->NodeID);
foreach ($nodeArray as $subTreeNode) {
eZContentLanguage::expireCache();
$meta = xrowMetaDataFunctions::fetchByNode($subTreeNode);
$extensions = array();
$extensions[] = new xrowSitemapItemModified($subTreeNode->attribute('modified_subnode'));
$url = $subTreeNode->attribute('url_alias');
eZURI::transformURI($url);
$url = 'http://' . $mobileDomain . $url;
if ($meta and $meta->sitemap_use != '0') {
$extensions[] = new xrowSitemapItemFrequency($meta->change);
$extensions[] = new xrowSitemapItemPriority($meta->priority);
$sitemap->add($url, $extensions);
} elseif ($meta === false and $xrowsitemapINI->variable('Settings', 'AlwaysAdd') == 'enabled') {
if ($addPrio) {
$rootDepth = $rootNode->attribute('depth');
$prio = 1 - ($subTreeNode->attribute('depth') - $rootDepth) / 10;
if ($prio > 0) {
$extensions[] = new xrowSitemapItemPriority($prio);
}
}
$sitemap->add($url, $extensions);
}
if (isset($bar)) {
$bar->advance();
}
}
eZContentObject::clearCache();
$params['Offset'] += $params['Limit'];
}
// write XML Sitemap to file
$dir = eZSys::storageDirectory() . '/sitemap/' . self::domain();
if (!is_dir($dir)) {
mkdir($dir, 0777, true);
}
$filename = $dir . '/' . xrowSitemap::BASENAME . '_' . self::FILETYP_MOBILE . '_' . $GLOBALS['eZCurrentAccess']['name'] . '.' . xrowSitemap::SUFFIX;
$sitemap->save($filename);
/**
* @TODO How will this work with cluster?
if ( function_exists( 'gzencode' ) and $xrowsitemapINI->variable( 'MobileSitemapSettings', 'Gzip' ) == 'enabled' )
{
$content = file_get_contents( $filename );
$content = gzencode( $content );
file_put_contents( $filename . '.gz', $content );
unlink( $filename );
$filename .= '.gz';
}
**/
if (!$isQuiet) {
$cli->output("\n");
$cli->output("Mobile sitemap {$filename} for siteaccess " . $GLOBALS['eZCurrentAccess']['name'] . " has been generated.\n");
}
}