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


PHP RecursiveIteratorIterator::getFilename方法代码示例

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


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

示例1: execute

 /**
  * Execute the command.
  *
  * @return  void
  *
  * @since   1.0
  */
 public function execute()
 {
     $this->getApplication()->outputTitle('Make Documentation');
     $this->usePBar = $this->getApplication()->get('cli-application.progress-bar');
     if ($this->getApplication()->input->get('noprogress')) {
         $this->usePBar = false;
     }
     $this->github = $this->getContainer()->get('gitHub');
     $this->getApplication()->displayGitHubRateLimit();
     /* @type \Joomla\Database\DatabaseDriver $db */
     $db = $this->getContainer()->get('db');
     $docuBase = JPATH_ROOT . '/Documentation';
     /* @type  \RecursiveDirectoryIterator $it */
     $it = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($docuBase, \FilesystemIterator::SKIP_DOTS));
     $this->out('Compiling documentation in: ' . $docuBase)->out();
     $table = new ArticlesTable($db);
     // @todo compile the md text here.
     $table->setGitHub($this->github);
     while ($it->valid()) {
         if ($it->isDir()) {
             $it->next();
             continue;
         }
         $file = new \stdClass();
         $file->filename = $it->getFilename();
         $path = $it->getSubPath();
         $page = substr($it->getFilename(), 0, strrpos($it->getFilename(), '.'));
         $this->debugOut('Compiling: ' . $page);
         $table->reset();
         $table->{$table->getKeyName()} = null;
         try {
             $table->load(array('alias' => $page, 'path' => $path));
         } catch (\RuntimeException $e) {
             // New item
         }
         $table->is_file = '1';
         $table->path = $it->getSubPath();
         $table->alias = $page;
         $table->text_md = file_get_contents($it->key());
         $table->store();
         $this->out('.', false);
         $it->next();
     }
     $this->out()->out('Finished =;)');
 }
开发者ID:dextercowley,项目名称:jissues,代码行数:52,代码来源:Docu.php

示例2: getFiles

 public function getFiles($dirname = '')
 {
     $arr_folder = array();
     $count = 0;
     $folder = UPLOAD_DIR;
     $folder .= DIRECTORY_SEPARATOR . $dirname;
     if (is_dir($folder)) {
         $dir = new RecursiveDirectoryIterator($folder);
         $iter = new RecursiveIteratorIterator($dir, RecursiveIteratorIterator::SELF_FIRST);
         while ($iter->valid()) {
             if (!$iter->isDot()) {
                 if ($iter->getDepth() < $this->maxDepth) {
                     $item = array();
                     $item['id'] = $count;
                     $item['size'] = $iter->getSize();
                     $item['type'] = $iter->getType();
                     $item['ext'] = $iter->getExtension();
                     $item['pathname'] = $iter->getSubPathName();
                     $item['filename'] = $iter->getFilename();
                     $item['parent'] = '/' . $dirname;
                     $item['Exec'] = $iter->isExecutable();
                     $item['sub'] = '';
                     $count++;
                     $arr_folder[] = $item;
                 }
             }
             $iter->next();
         }
         return $arr_folder;
     }
     if (is_file($folder)) {
         $file = file_get_contents($folder);
         if (empty($file)) {
             return ' ';
         }
         return $file;
     }
 }
开发者ID:andrianoUkr,项目名称:apifiles,代码行数:38,代码来源:IndexModel.php

示例3: array

 function get_image_file_array($folder)
 {
     $count = 0;
     $images = array();
     $image_data = array();
     $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($folder));
     $ext = array('.png', '.jpeg', '.jpg', '.jpe', '.gif', '.png', '.bmp', 'tif', 'tiff', '.ico');
     $skip_paths = explode("\r\n", get_option('image_cleanup_skip_paths', null));
     $skip_paths[] = 'imagecleanup';
     $start = microtime(true);
     $debuglog = self::$UPLOAD_DIR . '/imagecleanup/debug.json';
     while ($it->valid()) {
         if (!$it->isDot()) {
             if ($it->isFile()) {
                 if ($this->strposa($it->getFilename(), $ext) !== false) {
                     //$image_data['att_id'] = 'uknown';
                     $image_data['bd'] = dirname($it->key());
                     $image_data['fn'] = $it->getFilename();
                     $image_data['xist'] = true;
                     //stupid, yes-- but it saves a file_exist later on?
                     $skip = false;
                     $file = $image_data['bd'] . '/' . $image_data['fn'];
                     // check if path in skip array
                     foreach ($skip_paths as $key) {
                         // check if str in complete path and filename
                         if (stripos($file, $key) !== false) {
                             $skip = true;
                         }
                     }
                     if (!$skip) {
                         $images[] = $image_data;
                     }
                     $count++;
                 }
             }
         }
         $it->next();
     }
     return $images;
 }
开发者ID:mattdcarlile,项目名称:msite,代码行数:40,代码来源:image-cleanup.plugin.php

示例4: explode

     if (Params::getParam('file') != '') {
         $tmp = explode("/", Params::getParam('file'));
         $filename = end($tmp);
         osc_downloadFile(Params::getParam('file'), $filename);
         $message = __('File downloaded correctly');
     } else {
         $message = __('Missing filename');
     }
     break;
 case 'empty-temp':
     $message = __("Removing temp-directory");
     $path = ABS_PATH . 'oc-temp';
     $dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::CHILD_FIRST);
     for ($dir->rewind(); $dir->valid(); $dir->next()) {
         if ($dir->isDir()) {
             if ($dir->getFilename() != '.' && $dir->getFilename() != '..') {
                 rmdir($dir->getPathname());
             }
         } else {
             unlink($dir->getPathname());
         }
     }
     rmdir($path);
     break;
 case 'db-backup':
     osc_dbdump();
     break;
 case 'zip-osclass':
     $archive_name = ABS_PATH . "OSClass_backup." . date('YmdHis') . ".zip";
     $archive_folder = ABS_PATH;
     if (osc_zip_folder($archive_folder, $archive_name)) {
开发者ID:acharei,项目名称:OSClass,代码行数:31,代码来源:upgrade.php

示例5: doModel


//.........这里部分代码省略.........
                             if ($fail == 0) {
                                 // Everything is OK, continue
                                 /************************
                                  *** UPGRADE DATABASE ***
                                  ************************/
                                 $error_queries = array();
                                 if (file_exists(osc_lib_path() . 'osclass/installer/struct.sql')) {
                                     $sql = file_get_contents(osc_lib_path() . 'osclass/installer/struct.sql');
                                     $conn = DBConnectionClass::newInstance();
                                     $c_db = $conn->getOsclassDb();
                                     $comm = new DBCommandClass($c_db);
                                     $error_queries = $comm->updateDB(str_replace('/*TABLE_PREFIX*/', DB_TABLE_PREFIX, $sql));
                                 }
                                 if ($error_queries[0]) {
                                     // Everything is OK, continue
                                     /**********************************
                                      ** EXECUTING ADDITIONAL ACTIONS **
                                      **********************************/
                                     if (file_exists(osc_lib_path() . 'osclass/upgrade-funcs.php')) {
                                         // There should be no errors here
                                         define('AUTO_UPGRADE', true);
                                         require_once osc_lib_path() . 'osclass/upgrade-funcs.php';
                                     }
                                     // Additional actions is not important for the rest of the proccess
                                     // We will inform the user of the problems but the upgrade could continue
                                     /****************************
                                      ** REMOVE TEMPORARY FILES **
                                      ****************************/
                                     $path = ABS_PATH . 'oc-temp';
                                     $rm_errors = 0;
                                     $dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::CHILD_FIRST);
                                     for ($dir->rewind(); $dir->valid(); $dir->next()) {
                                         if ($dir->isDir()) {
                                             if ($dir->getFilename() != '.' && $dir->getFilename() != '..') {
                                                 if (!rmdir($dir->getPathname())) {
                                                     $rm_errors++;
                                                 }
                                             }
                                         } else {
                                             if (!unlink($dir->getPathname())) {
                                                 $rm_errors++;
                                             }
                                         }
                                     }
                                     if (!rmdir($path)) {
                                         $rm_errors++;
                                     }
                                     $deleted = @unlink(ABS_PATH . '.maintenance');
                                     if ($rm_errors == 0) {
                                         $message = __('Everything looks good! Your Osclass installation is up-to-date');
                                     } else {
                                         $message = __('Nearly everything looks good! Your Osclass installation is up-to-date, but there were some errors removing temporary files. Please manually remove the "oc-temp" folder');
                                         $error = 6;
                                         // Some errors removing files
                                     }
                                 } else {
                                     $sql_error_msg = $error_queries[2];
                                     $message = __('Problems when upgrading the database');
                                     $error = 5;
                                     // Problems upgrading the database
                                 }
                             } else {
                                 $message = __('Problems when copying files. Please check your permissions. ');
                                 $error = 4;
                                 // Problems copying files. Maybe permissions are not correct
                             }
开发者ID:jmcclenon,项目名称:Osclass,代码行数:67,代码来源:ajax.php

示例6: getHash

 /**
  * Return the MD5 hash of the folder
  * 
  * @return string The MD5 has
  */
 protected function getHash()
 {
     $arrFiles = array();
     $it = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(TL_ROOT . '/' . $this->strFolder, \FilesystemIterator::UNIX_PATHS));
     while ($it->valid()) {
         if ($it->isFile() && $it->getFilename() != '.DS_Store') {
             $arrFiles[] = $it->getSubPathname();
             $arrFiles[] = md5_file($it->getPathname());
         }
         $it->next();
     }
     return md5(implode('-', $arrFiles));
 }
开发者ID:rburch,项目名称:core,代码行数:18,代码来源:Folder.php

示例7: getHash

 /**
  * Return the MD5 hash of the folder
  *
  * @return string The MD5 has
  */
 protected function getHash()
 {
     $arrFiles = array();
     $it = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(TL_ROOT . '/' . $this->strFolder, \FilesystemIterator::UNIX_PATHS | \FilesystemIterator::FOLLOW_SYMLINKS | \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST);
     while ($it->valid()) {
         if ($it->getFilename() != '.DS_Store') {
             $arrFiles[] = $it->getSubPathname();
         }
         $it->next();
     }
     return md5(implode('-', $arrFiles));
 }
开发者ID:iCodr8,项目名称:core,代码行数:17,代码来源:Folder.php

示例8: exit

 * @version    1.5.0
 */
/**
 * Kebab Project Asset Bootstrapper
 *
 * On-Demad load and return all js files
 * @uses SPL - Standard PHP Library :: RecursiveIteratorIterator, RecursiveDirectoryIterator
 */
if (phpversion() < 5) {
    exit('/* Kebab Project Asset Bootstrapper requires PHP5 or greater. */');
}
ob_start("ob_gzhandler");
header("Content-type: text/javascript; charset: UTF-8");
// Define root path
defined('BASE_PATH') || define('BASE_PATH', realpath(dirname(__FILE__)) . '/');
// Load index.js once !important
@readfile(BASE_PATH . 'web/index.js');
print PHP_EOL;
// Recursive scan directory and files
$scanner = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(BASE_PATH));
while ($scanner->valid()) {
    if (!$scanner->isDot() && $scanner->isFile()) {
        $pathInfo = pathinfo($scanner->key());
        if (@$pathInfo['extension'] == 'js' && $scanner->getFilename() !== 'index.js') {
            @readfile($scanner->key());
            print PHP_EOL;
        }
    }
    $scanner->next();
}
ob_end_flush();
开发者ID:esironal,项目名称:kebab-project,代码行数:31,代码来源:index.php

示例9: doModel


//.........这里部分代码省略.........
                             if ($fail == 0) {
                                 // Everything is OK, continue
                                 /************************
                                  *** UPGRADE DATABASE ***
                                  ************************/
                                 $error_queries = array();
                                 if (file_exists(osc_lib_path() . 'osclass/installer/struct.sql')) {
                                     $sql = file_get_contents(osc_lib_path() . 'osclass/installer/struct.sql');
                                     $conn = DBConnectionClass::newInstance();
                                     $c_db = $conn->getOsclassDb();
                                     $comm = new DBCommandClass($c_db);
                                     $error_queries = $comm->updateDB(str_replace('/*TABLE_PREFIX*/', DB_TABLE_PREFIX, $sql));
                                 }
                                 if ($error_queries[0]) {
                                     // Everything is OK, continue
                                     /**********************************
                                      ** EXECUTING ADDITIONAL ACTIONS **
                                      **********************************/
                                     if (file_exists(osc_lib_path() . 'osclass/upgrade-funcs.php')) {
                                         // There should be no errors here
                                         define('AUTO_UPGRADE', true);
                                         require_once osc_lib_path() . 'osclass/upgrade-funcs.php';
                                     }
                                     // Additional actions is not important for the rest of the proccess
                                     // We will inform the user of the problems but the upgrade could continue
                                     /****************************
                                      ** REMOVE TEMPORARY FILES **
                                      ****************************/
                                     $path = ABS_PATH . 'oc-temp';
                                     $rm_errors = 0;
                                     $dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::CHILD_FIRST);
                                     for ($dir->rewind(); $dir->valid(); $dir->next()) {
                                         if ($dir->isDir()) {
                                             if ($dir->getFilename() != '.' && $dir->getFilename() != '..') {
                                                 if (!rmdir($dir->getPathname())) {
                                                     $rm_errors++;
                                                 }
                                             }
                                         } else {
                                             if (!unlink($dir->getPathname())) {
                                                 $rm_errors++;
                                             }
                                         }
                                     }
                                     if (!rmdir($path)) {
                                         $rm_errors++;
                                     }
                                     $deleted = @unlink(ABS_PATH . '.maintenance');
                                     if ($rm_errors == 0) {
                                         $message = __('Everything was OK! Your OSClass installation is updated');
                                     } else {
                                         $message = __('Almost everything was OK! Your OSClass installation is updated, but there were some errors removing temporary files. Please, remove manually the "oc-temp" folder');
                                         $error = 6;
                                         // Some errors removing files
                                     }
                                 } else {
                                     $sql_error_msg = $error_queries[2];
                                     $message = __('Problems upgrading the database');
                                     $error = 5;
                                     // Problems upgrading the database
                                 }
                             } else {
                                 $message = __('Problems copying files. Maybe permissions are not correct');
                                 $error = 4;
                                 // Problems copying files. Maybe permissions are not correct
                             }
开发者ID:ricktaylord,项目名称:OSClass,代码行数:67,代码来源:ajax.php

示例10: copy_them

 private function copy_them()
 {
     $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->current_dir, FilesystemIterator::SKIP_DOTS));
     while ($iterator->valid()) {
         if ($iterator->isFile()) {
             copy($iterator->getPathname(), $this->moved_dir . '/' . $iterator->getFilename());
         }
         $iterator->next();
     }
 }
开发者ID:JerryMaheswara,项目名称:crawler,代码行数:10,代码来源:unzipnrename.php

示例11: doModel


//.........这里部分代码省略.........
                                         }
                                     }
                                 }
                                 // Removing files is not important for the rest of the proccess
                                 // We will inform the user of the problems but the upgrade could continue
                                 /************************
                                  *** UPGRADE DATABASE ***
                                  ************************/
                                 $error_queries = array();
                                 if (file_exists(osc_lib_path() . 'osclass/installer/struct.sql')) {
                                     $sql = file_get_contents(osc_lib_path() . 'osclass/installer/struct.sql');
                                     $conn = getConnection();
                                     $error_queries = $conn->osc_updateDB(str_replace('/*TABLE_PREFIX*/', DB_TABLE_PREFIX, $sql));
                                 }
                                 if ($error_queries[0]) {
                                     // Everything is OK, continue
                                     /**********************************
                                      ** EXECUTING ADDITIONAL ACTIONS **
                                      **********************************/
                                     if (file_exists(osc_lib_path() . 'osclass/upgrade-funcs.php')) {
                                         // There should be no errors here
                                         require_once osc_lib_path() . 'osclass/upgrade-funcs.php';
                                     }
                                     // Additional actions is not important for the rest of the proccess
                                     // We will inform the user of the problems but the upgrade could continue
                                     /****************************
                                      ** REMOVE TEMPORARY FILES **
                                      ****************************/
                                     $path = ABS_PATH . 'oc-temp';
                                     $rm_errors = 0;
                                     $dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::CHILD_FIRST);
                                     for ($dir->rewind(); $dir->valid(); $dir->next()) {
                                         if ($dir->isDir()) {
                                             if ($dir->getFilename() != '.' && $dir->getFilename() != '..') {
                                                 if (!rmdir($dir->getPathname())) {
                                                     $rm_errors++;
                                                 }
                                             }
                                         } else {
                                             if (!unlink($dir->getPathname())) {
                                                 $rm_errors++;
                                             }
                                         }
                                     }
                                     if (!rmdir($path)) {
                                         $rm_errors++;
                                     }
                                     if ($rm_errors == 0) {
                                         $message = __('Everything was OK! Your OSClass installation is updated');
                                     } else {
                                         $message = __('Almost everything was OK! Your OSClass installation is updated, but there were some errors removing temporary files. Please, remove manually the "oc-temp" folder', 'admin');
                                         $error = 6;
                                         // Some errors removing files
                                     }
                                 } else {
                                     $sql_error_msg = $error_queries[2];
                                     $message = __('Problems upgrading the database', 'admin');
                                     $error = 5;
                                     // Problems upgrading the database
                                 }
                             } else {
                                 $message = __('Problems copying files. Maybe permissions are not correct', 'admin');
                                 $error = 4;
                                 // Problems copying files. Maybe permissions are not correct
                             }
                         } else {
开发者ID:hashemgamal,项目名称:OSClass,代码行数:67,代码来源:ajax.php

示例12: RecursiveIteratorIterator

<?php

$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__ . '/../../sample_dir'), RecursiveIteratorIterator::SELF_FIRST);
$files = array();
foreach ($it as $file) {
    $files[$file->getFilename()] = $it->getFilename() == $file->getFilename();
}
ksort($files);
var_dump($files);
开发者ID:badlamer,项目名称:hhvm,代码行数:9,代码来源:RecursiveIteratorIterator_call.php

示例13: osc_market

function osc_market($section, $code)
{
    $plugin = false;
    $re_enable = false;
    $message = "";
    $data = array();
    $download_post_data = array('api_key' => osc_market_api_connect());
    /************************
     *** CHECK VALID CODE ***
     ************************/
    if ($code != '' && $section != '') {
        if (stripos($code, "http://") === FALSE) {
            // OSCLASS OFFICIAL REPOSITORY
            $url = osc_market_url($section, $code);
            $data = osc_file_get_contents($url, array('api_key' => osc_market_api_connect()));
            $data = json_decode(osc_file_get_contents($url, array('api_key' => osc_market_api_connect())), true);
        } else {
            // THIRD PARTY REPOSITORY
            if (osc_market_external_sources()) {
                $download_post_data = array();
                $data = json_decode(osc_file_get_contents($code), true);
            } else {
                return array('error' => 9, 'message' => __('No external sources are allowed'), 'data' => $data);
            }
        }
        /***********************
         **** DOWNLOAD FILE ****
         ***********************/
        if (isset($data['s_update_url']) && isset($data['s_source_file']) && isset($data['e_type'])) {
            if ($data['e_type'] == 'THEME') {
                $folder = 'themes/';
            } else {
                if ($data['e_type'] == 'LANGUAGE') {
                    $folder = 'languages/';
                } else {
                    // PLUGINS
                    $folder = 'plugins/';
                    $plugin = Plugins::findByUpdateURI($data['s_update_url']);
                    if ($plugin != false) {
                        if (Plugins::isEnabled($plugin)) {
                            Plugins::runHook($plugin . '_disable');
                            Plugins::deactivate($plugin);
                            $re_enable = true;
                        }
                    }
                }
            }
            $filename = date('YmdHis') . "_" . osc_sanitize_string($data['s_title']) . "_" . $data['s_version'] . ".zip";
            $url_source_file = $data['s_source_file'];
            $result = osc_downloadFile($url_source_file, $filename, $download_post_data);
            if ($result) {
                // Everything is OK, continue
                /**********************
                 ***** UNZIP FILE *****
                 **********************/
                @mkdir(osc_content_path() . 'downloads/oc-temp/');
                $res = osc_unzip_file(osc_content_path() . 'downloads/' . $filename, osc_content_path() . 'downloads/oc-temp/');
                if ($res == 1) {
                    // Everything is OK, continue
                    /**********************
                     ***** COPY FILES *****
                     **********************/
                    $fail = -1;
                    if ($handle = opendir(osc_content_path() . 'downloads/oc-temp')) {
                        $folder_dest = ABS_PATH . "oc-content/" . $folder;
                        if (function_exists('posix_getpwuid')) {
                            $current_user = posix_getpwuid(posix_geteuid());
                            $ownerFolder = posix_getpwuid(fileowner($folder_dest));
                        }
                        $fail = 0;
                        while (false !== ($_file = readdir($handle))) {
                            if ($_file != '.' && $_file != '..') {
                                $copyprocess = osc_copy(osc_content_path() . "downloads/oc-temp/" . $_file, $folder_dest . $_file);
                                if ($copyprocess == false) {
                                    $fail = 1;
                                }
                            }
                        }
                        closedir($handle);
                        // Additional actions is not important for the rest of the proccess
                        // We will inform the user of the problems but the upgrade could continue
                        // Also remove the zip package
                        /****************************
                         ** REMOVE TEMPORARY FILES **
                         ****************************/
                        @unlink(osc_content_path() . 'downloads/' . $filename);
                        $path = osc_content_path() . 'downloads/oc-temp';
                        $rm_errors = 0;
                        $dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::CHILD_FIRST);
                        for ($dir->rewind(); $dir->valid(); $dir->next()) {
                            if ($dir->isDir()) {
                                if ($dir->getFilename() != '.' && $dir->getFilename() != '..') {
                                    if (!rmdir($dir->getPathname())) {
                                        $rm_errors++;
                                    }
                                }
                            } else {
                                if (!unlink($dir->getPathname())) {
                                    $rm_errors++;
                                }
//.........这里部分代码省略.........
开发者ID:naneri,项目名称:Osclass,代码行数:101,代码来源:utils.php

示例14: doModel


//.........这里部分代码省略.........
                                     }
                                 }
                                 // Removing files is not important for the rest of the proccess
                                 // We will inform the user of the problems but the upgrade could continue
                                 /************************
                                  *** UPGRADE DATABASE ***
                                  ************************/
                                 $error_queries = array();
                                 if (file_exists(osc_lib_path() . 'osclass/installer/struct.sql')) {
                                     $sql = file_get_contents(osc_lib_path() . 'osclass/installer/struct.sql');
                                     $conn = getConnection();
                                     $error_queries = $conn->osc_updateDB(str_replace('/*TABLE_PREFIX*/', DB_TABLE_PREFIX, $sql));
                                 }
                                 if ($error_queries[0]) {
                                     // Everything is OK, continue
                                     /**********************************
                                      ** EXECUTING ADDITIONAL ACTIONS **
                                      **********************************/
                                     if (file_exists(osc_lib_path() . 'osclass/upgrade-funcs.php')) {
                                         // There should be no errors here
                                         define('AUTO_UPGRADE', true);
                                         require_once osc_lib_path() . 'osclass/upgrade-funcs.php';
                                     }
                                     // Additional actions is not important for the rest of the proccess
                                     // We will inform the user of the problems but the upgrade could continue
                                     /****************************
                                      ** REMOVE TEMPORARY FILES **
                                      ****************************/
                                     $path = ABS_PATH . 'oc-temp';
                                     $rm_errors = 0;
                                     $dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::CHILD_FIRST);
                                     for ($dir->rewind(); $dir->valid(); $dir->next()) {
                                         if ($dir->isDir()) {
                                             if ($dir->getFilename() != '.' && $dir->getFilename() != '..') {
                                                 if (!rmdir($dir->getPathname())) {
                                                     $rm_errors++;
                                                 }
                                             }
                                         } else {
                                             if (!unlink($dir->getPathname())) {
                                                 $rm_errors++;
                                             }
                                         }
                                     }
                                     if (!rmdir($path)) {
                                         $rm_errors++;
                                     }
                                     $deleted = @unlink(ABS_PATH . '.maintenance');
                                     if ($rm_errors == 0) {
                                         $message = __('Everything was OK! Your OSClass installation is updated');
                                     } else {
                                         $message = __('Almost everything was OK! Your OSClass installation is updated, but there were some errors removing temporary files. Please, remove manually the "oc-temp" folder');
                                         $error = 6;
                                         // Some errors removing files
                                     }
                                 } else {
                                     $sql_error_msg = $error_queries[2];
                                     $message = __('Problems upgrading the database');
                                     $error = 5;
                                     // Problems upgrading the database
                                 }
                             } else {
                                 $message = __('Problems copying files. Maybe permissions are not correct');
                                 $error = 4;
                                 // Problems copying files. Maybe permissions are not correct
                             }
开发者ID:nsswaga,项目名称:OSClass,代码行数:67,代码来源:ajax.php

示例15: run

 /**
  * run() method load specified directory
  *
  * @param array params
  * @return array
  */
 public function run(array $aParams)
 {
     // test of obligatory validated path
     if (isset($aParams['path']) && is_dir($aParams['path']) && (isset($aParams['pattern']) || isset($aParams['extension']))) {
         // init object
         $oDirRecIterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($aParams['path']));
         // case of not recursive
         if (isset($aParams['recursive']) === false || isset($aParams['recursive']) === true && $aParams['recursive'] === false) {
             $oDirRecIterator->setMaxDepth(1);
         }
         // clear array
         $this->_aFiles = array();
         // rewind
         $this->rewind();
         $iCount = 0;
         // loop on object result
         while ($oDirRecIterator->valid()) {
             if ($oDirRecIterator->isDot() === false) {
                 // get file name
                 $sFileName = $oDirRecIterator->getFilename();
                 if (isset($aParams['pattern']) && preg_match($aParams['pattern'], $sFileName) || isset($aParams['extension']) && substr(strtolower($sFileName), strrpos($sFileName, '.') + 1) == $aParams['extension']) {
                     $this->_aFiles[$iCount]['path'] = $oDirRecIterator->key();
                     $this->_aFiles[$iCount]['filename'] = $sFileName;
                     // case of subpath
                     if (isset($aParams['subpath']) && $aParams['subpath']) {
                         $this->_aFiles[$iCount]['subpath'] = $oDirRecIterator->getSubPath();
                     }
                     // case of subpathname
                     if (isset($aParams['subpathname']) && $aParams['subpathname']) {
                         $this->_aFiles[$iCount]['subpathname'] = $oDirRecIterator->getSubPathname();
                     }
                     // case of size
                     if (isset($aParams['size']) && $aParams['size']) {
                         $this->_aFiles[$iCount]['size'] = $oDirRecIterator->getSize();
                     }
                     // case of type
                     if (isset($aParams['type']) && $aParams['type']) {
                         $this->_aFiles[$iCount]['type'] = $oDirRecIterator->getType();
                     }
                     // case of owner
                     if (isset($aParams['owner']) && $aParams['owner']) {
                         $this->_aFiles[$iCount]['owner'] = $oDirRecIterator->getOwner();
                     }
                     // case of group
                     if (isset($aParams['group']) && $aParams['group']) {
                         $this->_aFiles[$iCount]['group'] = $oDirRecIterator->getGroup();
                     }
                     // case of time
                     if (isset($aParams['time']) && $aParams['time']) {
                         $this->_aFiles[$iCount]['time'] = $oDirRecIterator->getCTime();
                     }
                     // case of verbose
                     if (isset($aParams['verbose']) && $aParams['verbose']) {
                         echo '[ ', isset($aParams['service']) ? $aParams['service'] : 'FILE', ' ] ', date("d-m-Y à H:i:s"), ' =>  matched file : ', $sFileName, "\n";
                     }
                     ++$iCount;
                 }
             }
             $oDirRecIterator->next();
         }
         // destruct object
         unset($oDirRecIterator);
         // return
         return $this->_aFiles;
     } else {
         // throw exception if specified directory is not declared
         throw new Exception('Specified path or extension or pattern are not declared or is not a valid path');
     }
 }
开发者ID:sho5kubota,项目名称:guidingyou2,代码行数:75,代码来源:dir-reader.class.php


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