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


PHP RecursiveIteratorIterator::getPathname方法代码示例

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


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

示例1: delete

 public function delete()
 {
     if (!$this->loadData()) {
         $this->dataError();
         sendBack();
     }
     $moduleobject = $this->_uses[$this->modeltype];
     $db = DB::Instance();
     $db->StartTrans();
     if ($moduleobject->isLoaded()) {
         $modulename = $moduleobject->name;
         $modulelocation = FILE_ROOT . $moduleobject->location;
         if ($moduleobject->enabled && !$moduleobject->disable()) {
             $errors[] = 'Failed to disable module';
         }
         if ($moduleobject->registered && !$moduleobject->unregister()) {
             $errors[] = 'Failed to unregister module';
         }
         if (!$moduleobject->delete()) {
             $errors[] = 'Failed to delete module';
         } else {
             $dir = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($modulelocation), RecursiveIteratorIterator::CHILD_FIRST);
             for ($dir->rewind(); $dir->valid(); $dir->next()) {
                 if ($dir->isDir()) {
                     rmdir($dir->getPathname());
                 } else {
                     unlink($dir->getPathname());
                 }
             }
             rmdir($modulelocation);
         }
     } else {
         $errors[] = 'Cannot find module';
     }
     $flash = Flash::Instance();
     if (count($errors) > 0) {
         $db->FailTrans();
         $flash->addErrors($errors);
         if (isset($this->_data['id'])) {
             $db->CompleteTrans();
             sendTo($this->name, 'view', $this->_modules, array('id' => $this->_data['id']));
         }
     } else {
         $flash->addMessage('Module ' . $modulename . ' deleted OK');
     }
     $db->CompleteTrans();
     sendTo($this->name, 'index', $this->_modules);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:48,代码来源:ModuleobjectsController.php

示例2: explode

         $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)) {
         $message = __('Archiving is sucessful!');
开发者ID:acharei,项目名称:OSClass,代码行数:31,代码来源:upgrade.php

示例3: doModel


//.........这里部分代码省略.........
                                 // 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
                             }
                         } else {
开发者ID:jmcclenon,项目名称:Osclass,代码行数:67,代码来源:ajax.php

示例4: 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

示例5: makeCorrectDir

             /*
              * see if we have some php-fcgid leftovers if used
              * and remove them, #200
              */
             if ($settings['system']['mod_fcgid'] == 1) {
                 // e.g. /var/www/php-fcgi-starter/web1/
                 $configdir = makeCorrectDir($settings['system']['mod_fcgid_configdir'] . '/' . $row['data']['loginname'] . '/');
                 if (is_dir($configdir)) {
                     $its = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configdir));
                     // iterate through all subdirs,
                     // look for php-fcgi-starter files
                     // and take immutable-flag away from them
                     // so we can delete them :)
                     foreach ($its as $fullFileName => $it) {
                         if ($it->isFile() && $it->getFilename() == 'php-fcgi-starter') {
                             removeImmutable($its->getPathname());
                         }
                     }
                     // now get rid of old stuff
                     safe_exec('rm -rf ' . escapeshellarg($configdir));
                 }
             }
         }
     }
 } elseif ($row['type'] == '7') {
     fwrite($debugHandler, '  cron_tasks: Task7 started - deleting customer e-mail data' . "\n");
     $cronlog->logAction(CRON_ACTION, LOG_INFO, 'Task7 started - deleting customer e-mail data');
     if (is_array($row['data'])) {
         if (isset($row['data']['loginname']) && isset($row['data']['email'])) {
             /*
              * remove specific maildir
开发者ID:qinhai,项目名称:debian-anmpz,代码行数:31,代码来源:cron_tasks.php

示例6: doModel


//.........这里部分代码省略.........
                                 // 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
                             }
                         } else {
开发者ID:ricktaylord,项目名称:OSClass,代码行数:67,代码来源:ajax.php

示例7: 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

示例8: Pimple

require 'vendor/autoload.php';
$config = (require 'config/application.php');
// Initialize all services in the container
$app = new Pimple();
$debug = $app['debug'] = isset($argv[1]) && $argv[1] === '--debug' || $config['debug'];
require 'src/services.php';
// Initialize index storage
$index = [];
// Clear sheet cache directory
$app['sheet_cache']->clear();
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('sheets/'));
$iterator->rewind();
while ($iterator->valid()) {
    if (!$iterator->isDot()) {
        $path = str_replace(['\\', '.xml'], ['/', ''], $iterator->getSubPathname());
        $sheet = new SheetParser($path, $iterator->getPathname(), $config, $debug);
        $meta = $sheet->parseMeta();
        $content = $sheet->parseContent();
        $index['sheets'][$path] = ['title' => $meta->title, 'summary' => $meta->summary, 'keywords' => $meta->keywords, 'category' => $iterator->getSubPath(), 'path' => $path];
        $index['categories'][] = $iterator->getSubPath();
        $app['sheet_cache']->write($path, $content);
        unset($sheet, $path, $meta, $content);
    }
    $iterator->next();
}
$index['categories'] = array_unique($index['categories']);
$index['category_names'] = (require 'config/categories.php');
// Write index in JSON format
if ($debug) {
    $jsonFlags = JSON_PRETTY_PRINT;
} else {
开发者ID:Comandeer,项目名称:overdocs,代码行数:31,代码来源:build.php

示例9: 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 {
                             $message = __('Nothing to copy', 'admin');
开发者ID:hashemgamal,项目名称:OSClass,代码行数:67,代码来源:ajax.php

示例10: execute

 public static function execute($params)
 {
     // Set progress
     Ai1wm_Status::info(__('Retrieving a list of all WordPress files...', AI1WM_PLUGIN_NAME));
     // Set exclude filters
     $exclude_filters = ai1wm_content_filters();
     // Exclude cache
     if (isset($params['options']['no_cache'])) {
         $exclude_filters[] = 'cache';
     }
     // Exclude themes
     if (isset($params['options']['no_themes'])) {
         $exclude_filters[] = 'themes';
     } else {
         $inactive_themes = array();
         // Exclude inactive themes
         if (isset($params['options']['no_inactive_themes'])) {
             foreach (wp_get_themes() as $theme => $info) {
                 // Exclude current parent and child themes
                 if (!in_array($theme, array(get_template(), get_stylesheet()))) {
                     $inactive_themes[] = 'themes' . DIRECTORY_SEPARATOR . $theme;
                 }
             }
         }
         // Set exclude filters
         $exclude_filters = array_merge($exclude_filters, $inactive_themes);
     }
     // Exclude plugins
     if (isset($params['options']['no_plugins'])) {
         $exclude_filters = array_merge($exclude_filters, array('plugins', 'mu-plugins'));
     } else {
         $inactive_plugins = array();
         // Exclude inactive plugins
         if (isset($params['options']['no_inactive_plugins'])) {
             foreach (get_plugins() as $basename => $plugin) {
                 if (is_plugin_inactive($basename)) {
                     if (dirname($basename) === '.') {
                         $inactive_plugins[] = 'plugins' . DIRECTORY_SEPARATOR . basename($basename);
                     } else {
                         $inactive_plugins[] = 'plugins' . DIRECTORY_SEPARATOR . dirname($basename);
                     }
                 }
             }
         }
         // Set exclude filters
         $exclude_filters = array_merge($exclude_filters, ai1wm_plugin_filters($inactive_plugins));
     }
     // Exclude media
     if (isset($params['options']['no_media'])) {
         $exclude_filters = array_merge($exclude_filters, array('uploads', 'blogs.dir'));
     }
     // Get total files
     if (isset($params['total_files'])) {
         $total_files = (int) $params['total_files'];
     } else {
         $total_files = 0;
     }
     // Get total size
     if (isset($params['total_size'])) {
         $total_size = (int) $params['total_size'];
     } else {
         $total_size = 0;
     }
     // Create map file
     $filemap = fopen(ai1wm_filemap_path($params), 'a+');
     try {
         // Iterate over content directory
         $iterator = new Ai1wm_Recursive_Directory_Iterator(WP_CONTENT_DIR);
         // Exclude uploads, plugins or themes
         $iterator = new Ai1wm_Recursive_Exclude_Filter($iterator, apply_filters('ai1wm_exclude_content_from_export', $exclude_filters));
         // Recursively iterate over content directory
         $iterator = new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD);
         // Write path line
         foreach ($iterator as $item) {
             if ($item->isFile()) {
                 if (fwrite($filemap, $iterator->getSubPathName() . PHP_EOL)) {
                     $total_files++;
                     // Add current file size
                     $total_size += filesize($iterator->getPathname());
                 }
             }
         }
     } catch (Exception $e) {
         // Skip bad file permissions
     }
     // Set total files
     $params['total_files'] = $total_files;
     // Set total size
     $params['total_size'] = $total_size;
     // Close the filemap file
     fclose($filemap);
     // Set progress
     Ai1wm_Status::info(__('Done retrieving a list of all WordPress files.', AI1WM_PLUGIN_NAME));
     return $params;
 }
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:95,代码来源:class-ai1wm-export-enumerate.php

示例11: 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

示例12: _cleanFcgidFiles

 /**
  * remove fcgid related configuration files before regeneration
  *
  * @return null
  */
 private function _cleanFcgidFiles()
 {
     if (Settings::Get('system.mod_fcgid') == '0') {
         return;
     }
     // get correct directory
     $configdir = $this->_getFile('system', 'mod_fcgid_configdir');
     if ($configdir !== false) {
         $configdir = makeCorrectDir($configdir);
         if (@is_dir($configdir)) {
             // create directory iterator
             $its = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($configdir));
             // iterate through all subdirs,
             // look for php-fcgi-starter files
             // and take immutable-flag away from them
             // so we can delete them :)
             foreach ($its as $fullFileName => $it) {
                 if ($it->isFile() && $it->getFilename() == 'php-fcgi-starter') {
                     // set chattr -i
                     removeImmutable($its->getPathname());
                 }
             }
             // now get rid of old stuff
             //(but append /* so we don't delete the directory)
             $configdir .= '/*';
             safe_exec('rm -rf ' . makeCorrectFile($configdir));
         }
     }
 }
开发者ID:cobrafast,项目名称:Froxlor,代码行数:34,代码来源:class.ConfigIO.php

示例13: 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
                             }
                         } else {
开发者ID:nsswaga,项目名称:OSClass,代码行数:67,代码来源:ajax.php

示例14: execute

	public static function execute( $params ) {

		// Set progress
		Ai1wm_Status::info( __( 'Retrieving a list of all WordPress files...', AI1WM_PLUGIN_NAME ) );

		// Set exclude filters
		$exclude_filters = ai1wm_content_filters();

		// Exclude themes
		if ( isset( $params['options']['no_themes'] ) ) {
			$exclude_filters[] = 'themes';
		}

		// Exclude plugins
		if ( isset( $params['options']['no_plugins'] ) ) {
			$exclude_filters = array_merge( $exclude_filters, array( 'plugins', 'mu-plugins' ) );
		} else {
			$exclude_filters = array_merge( $exclude_filters, ai1wm_plugin_filters() );
		}

		// Exclude media
		if ( isset( $params['options']['no_media'] ) ) {
			$exclude_filters[] = 'uploads';
		}

		// Get total files
		if ( isset( $params['total_files'] ) ) {
			$total_files = (int) $params['total_files'];
		} else {
			$total_files = 0;
		}

		// Get total size
		if ( isset( $params['total_size'] ) ) {
			$total_size = (int) $params['total_size'];
		} else {
			$total_size = 0;
		}

		// Create map file
		$filemap = fopen( ai1wm_filemap_path( $params ) , 'a+' );

		try {

			// Iterate over content directory
			$iterator = new Ai1wm_Recursive_Directory_Iterator( WP_CONTENT_DIR );

			// Exclude uploads, plugins or themes
			$iterator = new Ai1wm_Recursive_Exclude_Filter( $iterator, $exclude_filters );

			// Recursively iterate over content directory
			$iterator = new RecursiveIteratorIterator( $iterator, RecursiveIteratorIterator::LEAVES_ONLY, RecursiveIteratorIterator::CATCH_GET_CHILD );

			// Write path line
			foreach ( $iterator as $item ) {
				if ( $item->isFile() ) {
					if ( fwrite( $filemap, $iterator->getSubPathName() . PHP_EOL ) ) {
						$total_files++;

						// Add current file size
						$total_size += filesize( $iterator->getPathname() );
					}
				}
			}

		} catch ( Exception $e ) {
			// Skip bad file permissions
		}

		// Set total files
		$params['total_files'] = $total_files;

		// Set total size
		$params['total_size'] = $total_size;

		// Close the filemap file
		fclose( $filemap );

		// Set progress
		Ai1wm_Status::info( __( 'Done retrieving a list of all WordPress files.', AI1WM_PLUGIN_NAME ) );

		return $params;
	}
开发者ID:jknowles94,项目名称:Work-examples,代码行数:83,代码来源:class-ai1wm-export-enumerate.php

示例15: _cleanZonefiles

 private function _cleanZonefiles()
 {
     $config_dir = makeCorrectFile(Settings::Get('system.bindconf_directory') . '/domains/');
     $this->_logger->logAction(CRON_ACTION, LOG_INFO, 'Cleaning dns zone files from ' . $config_dir);
     // check directory
     if (@is_dir($config_dir)) {
         // create directory iterator
         $its = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($config_dir));
         // iterate through all subdirs, look for zone files and delete them
         foreach ($its as $it) {
             if ($it->isFile()) {
                 // remove file
                 safe_exec('rm -f ' . escapeshellarg(makeCorrectFile($its->getPathname())));
             }
         }
     }
 }
开发者ID:asemen,项目名称:Froxlor,代码行数:17,代码来源:cron_tasks.inc.dns.10.bind.php


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