当前位置: 首页>>代码示例>>PHP>>正文


PHP AEUtilFilesystem::translateStockDirs方法代码示例

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


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

示例1: import

 public function import($file)
 {
     $directory = $this->getState('directory', '');
     $directory = AEUtilFilesystem::translateStockDirs($directory);
     // Find out how many parts there are
     $multipart = 0;
     $base = substr($file, 0, -4);
     $ext = substr($file, -3);
     $found = true;
     $total_size = @filesize($directory . '/' . $file);
     while ($found) {
         $multipart++;
         $newExtension = substr($ext, 0, 1) . sprintf('%02u', $multipart);
         $newFile = $directory . '/' . $base . '.' . $newExtension;
         $found = file_exists($newFile);
         if ($found) {
             $total_size += @filesize($newFile);
         }
     }
     $filetime = @filemtime($directory . '/' . $file);
     if (empty($filetime)) {
         $filetime = time();
     }
     // Create a new backup record
     $record = array('description' => JText::_('DISCOVER_LABEL_IMPORTEDDESCRIPTION'), 'comment' => '', 'backupstart' => date('Y-m-d H:i:s', $filetime), 'backupend' => date('Y-m-d H:i:s', $filetime + 1), 'status' => 'complete', 'origin' => 'backend', 'type' => 'full', 'profile_id' => 1, 'archivename' => $file, 'absolute_path' => $directory . '/' . $file, 'multipart' => $multipart, 'tag' => 'backend', 'filesexist' => 1, 'remote_filename' => '', 'total_size' => $total_size);
     $id = null;
     $id = AEPlatform::getInstance()->set_or_update_statistics($id, $record, $this);
 }
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:28,代码来源:discovers.php

示例2: apply

 /**
  * Handle the apply task which saves settings and shows the editor again
  *
  */
 public function apply()
 {
     // CSRF prevention
     if (!JRequest::getVar(JUtility::getToken(), false, 'POST')) {
         JError::raiseError('403', JText::_(version_compare(JVERSION, '1.6.0', 'ge') ? 'JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN' : 'Request Forbidden'));
     }
     // Get the var array from the request
     $var = JRequest::getVar('var', array(), 'default', 'array');
     // Make it into Akeeba Engine array format
     $data = array();
     foreach ($var as $key => $value) {
         $data[$key] = $value;
     }
     // Forbid stupidly selecting the site's root as the output or temporary directory
     if (array_key_exists('akeeba.basic.output_directory', $data)) {
         $folder = $data['akeeba.basic.output_directory'];
         $folder = AEUtilFilesystem::translateStockDirs($folder, true, true);
         $check = AEUtilFilesystem::translateStockDirs('[SITEROOT]', true, true);
         if ($check == $folder) {
             JError::raiseWarning(503, JText::_('CONFIG_OUTDIR_ROOT'));
             $data['akeeba.basic.output_directory'] = '[DEFAULT_OUTPUT]';
         }
     }
     // Merge it
     $config = AEFactory::getConfiguration();
     $config->mergeArray($data, false, false);
     // Save configuration
     AEPlatform::getInstance()->save_configuration();
     $this->setRedirect(JURI::base() . 'index.php?option=' . JRequest::getCmd('option') . '&view=config', JText::_('CONFIG_SAVE_OK'));
 }
开发者ID:srbsnkr,项目名称:sellingonlinemadesimple,代码行数:34,代码来源:config.php

示例3: saveEngineConfig

 public function saveEngineConfig()
 {
     $data = $this->getState('engineconfig', array());
     // Forbid stupidly selecting the site's root as the output or temporary directory
     if (array_key_exists('akeeba.basic.output_directory', $data)) {
         $folder = $data['akeeba.basic.output_directory'];
         $folder = AEUtilFilesystem::translateStockDirs($folder, true, true);
         $check = AEUtilFilesystem::translateStockDirs('[SITEROOT]', true, true);
         if ($check == $folder) {
             JError::raiseWarning(503, JText::_('CONFIG_OUTDIR_ROOT'));
             $data['akeeba.basic.output_directory'] = '[DEFAULT_OUTPUT]';
         }
     }
     // Merge it
     $config = AEFactory::getConfiguration();
     $config->mergeArray($data, false, false);
     // Save configuration
     AEPlatform::getInstance()->save_configuration();
 }
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:19,代码来源:configs.php

示例4: treatDirectory

 private static function treatDirectory($directory)
 {
     // Get the site's root
     $configuration = AEFactory::getConfiguration();
     if ($configuration->get('akeeba.platform.override_root', 0)) {
         $root = $configuration->get('akeeba.platform.newroot', '[SITEROOT]');
         if (stristr($root, '[')) {
             $root = AEUtilFilesystem::translateStockDirs($root);
         }
         $site_root = AEUtilFilesystem::TrimTrailingSlash(AEUtilFilesystem::TranslateWinPath($root));
     } else {
         $site_root = AEUtilFilesystem::TrimTrailingSlash(AEUtilFilesystem::TranslateWinPath(JPATH_ROOT));
     }
     $directory = AEUtilFilesystem::TrimTrailingSlash(AEUtilFilesystem::TranslateWinPath($directory));
     // Trim site root from beginning of directory
     if (substr($directory, 0, strlen($site_root)) == $site_root) {
         $directory = substr($directory, strlen($site_root));
         if (substr($directory, 0, 1) == '/') {
             $directory = substr($directory, 1);
         }
     }
     return $directory;
 }
开发者ID:01J,项目名称:topm,代码行数:23,代码来源:srpskipfiles.php

示例5: scan_directory

 /**
  * Scans a directory for files and directories, updating the directory_list and file_list
  * private fields
  *
  * @return bool True if more work has to be done, false if the dirextory stack is empty
  */
 private function scan_directory()
 {
     // Are we supposed to scan for more files?
     if ($this->done_scanning) {
         return true;
     }
     // Get the next directory to scan, if the folders and files of the last directory
     // have been scanned.
     if ($this->done_subdir_scanning && $this->done_file_scanning) {
         if (count($this->directory_list) == 0) {
             // No directories left to scan
             return false;
         } else {
             // Get and remove the last entry from the $directory_list array
             $this->current_directory = array_pop($this->directory_list);
             $this->setStep($this->current_directory);
             $this->done_subdir_scanning = false;
             $this->done_file_scanning = false;
             $this->processed_files_counter = 0;
         }
     }
     $engine = AEFactory::getScanEngine();
     // Break directory components
     if (AEFactory::getConfiguration()->get('akeeba.platform.override_root', 0)) {
         $siteroot = AEFactory::getConfiguration()->get('akeeba.platform.newroot', '[SITEROOT]');
     } else {
         $siteroot = '[SITEROOT]';
     }
     $root = $this->root;
     if ($this->root == $siteroot) {
         $translated_root = AEUtilFilesystem::translateStockDirs($siteroot, true);
     } else {
         $translated_root = $this->remove_path_prefix;
     }
     $dir = AEUtilFilesystem::TrimTrailingSlash($this->current_directory);
     if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
         $translated_root = AEUtilFilesystem::TranslateWinPath($translated_root);
         $dir = AEUtilFilesystem::TranslateWinPath($dir);
     }
     if (substr($dir, 0, strlen($translated_root)) == $translated_root) {
         $dir = substr($dir, strlen($translated_root));
     } elseif (in_array(substr($translated_root, -1), array('/', '\\'))) {
         $new_translated_root = rtrim($translated_root, '/\\');
         if (substr($dir, 0, strlen($new_translated_root)) == $new_translated_root) {
             $dir = substr($dir, strlen($new_translated_root));
         }
     }
     if (substr($dir, 0, 1) == '/') {
         $dir = substr($dir, 1);
     }
     // get a filters instance
     $filters = AEFactory::getFilters();
     // Scan subdirectories, if they have not yet been scanned.
     if (!$this->done_subdir_scanning) {
         // Apply DEF (directory exclusion filters)
         // Note: the !empty($dir) prevents the site's root from being filtered out
         if ($filters->isFiltered($dir, $root, 'dir', 'all') && !empty($dir)) {
             AEUtilLogger::WriteLog(_AE_LOG_INFO, "Skipping directory " . $this->current_directory);
             $this->done_subdir_scanning = true;
             $this->done_file_scanning = true;
             return true;
         }
         // Apply Skip Contained Directories Filters
         if ($filters->isFiltered($dir, $root, 'dir', 'children')) {
             AEUtilLogger::WriteLog(_AE_LOG_INFO, "Skipping subdirectories of directory " . $this->current_directory);
             $this->done_subdir_scanning = true;
         } else {
             AEUtilLogger::WriteLog(_AE_LOG_INFO, "Scanning directories of " . $this->current_directory);
             // Get subdirectories
             $subdirs = $engine->getFolders($this->current_directory);
             // Error propagation
             $this->propagateFromObject($engine);
             // If the list contains "too many" items, please break this step!
             $registry = AEFactory::getConfiguration();
             if ($registry->get('volatile.breakflag', false)) {
                 // Log the step break decision, for debugging reasons
                 AEUtilLogger::WriteLog(_AE_LOG_INFO, "Large directory " . $this->current_directory . " while scanning for subdirectories; I will resume scanning in next step.");
                 // Return immediately, marking that we are not done yet!
                 return true;
             }
             // Error control
             if ($this->getError()) {
                 return false;
             }
             if (!empty($subdirs) && is_array($subdirs)) {
                 $registry = AEFactory::getConfiguration();
                 $dereferencesymlinks = $registry->get('engine.archiver.common.dereference_symlinks');
                 if ($dereferencesymlinks) {
                     // Treat symlinks to directories as actual directories
                     foreach ($subdirs as $subdir) {
                         $this->directory_list[] = $subdir;
                         $this->progressAddFolder();
                     }
                 } else {
//.........这里部分代码省略.........
开发者ID:brojask,项目名称:colegio-abogados-joomla,代码行数:101,代码来源:pack.php

示例6: getCleanDirectoryComponents

 /**
  * Returns the site root, the translated site root and the translated current directory
  *
  * @return array
  */
 private function getCleanDirectoryComponents()
 {
     // Break directory components
     if (AEFactory::getConfiguration()->get('akeeba.platform.override_root', 0)) {
         $siteroot = AEFactory::getConfiguration()->get('akeeba.platform.newroot', '[SITEROOT]');
     } else {
         $siteroot = '[SITEROOT]';
     }
     $root = $this->root;
     if ($this->root == $siteroot) {
         $translated_root = AEUtilFilesystem::translateStockDirs($siteroot, true);
     } else {
         $translated_root = $this->remove_path_prefix;
     }
     $dir = AEUtilFilesystem::TrimTrailingSlash($this->current_directory);
     if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
         $translated_root = AEUtilFilesystem::TranslateWinPath($translated_root);
         $dir = AEUtilFilesystem::TranslateWinPath($dir);
     }
     if (substr($dir, 0, strlen($translated_root)) == $translated_root) {
         $dir = substr($dir, strlen($translated_root));
     } elseif (in_array(substr($translated_root, -1), array('/', '\\'))) {
         $new_translated_root = rtrim($translated_root, '/\\');
         if (substr($dir, 0, strlen($new_translated_root)) == $new_translated_root) {
             $dir = substr($dir, strlen($new_translated_root));
         }
     }
     if (substr($dir, 0, 1) == '/') {
         $dir = substr($dir, 1);
     }
     return array($root, $translated_root, $dir);
 }
开发者ID:greyhat777,项目名称:vuslinterliga,代码行数:37,代码来源:pack.php


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