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


PHP MainWP_Utility::isArchive方法代码示例

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


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

示例1: mainwp_cronupdatescheck_action


//.........这里部分代码省略.........
             return;
         }
         if (get_option('mainwp_automaticDailyUpdate') != 1) {
             return;
         }
         //Check if backups are required!
         if (get_option('mainwp_backup_before_upgrade') == 1) {
             $sitesCheckCompleted = get_option('mainwp_automaticUpdate_backupChecks');
             if (!is_array($sitesCheckCompleted)) {
                 $sitesCheckCompleted = array();
             }
             $websitesToCheck = array();
             foreach ($pluginsToUpdateNow as $websiteId => $slugs) {
                 $websitesToCheck[$websiteId] = true;
             }
             foreach ($themesToUpdateNow as $websiteId => $slugs) {
                 $websitesToCheck[$websiteId] = true;
             }
             foreach ($coreToUpdateNow as $websiteId) {
                 $websitesToCheck[$websiteId] = true;
             }
             foreach ($websitesToCheck as $siteId => $bool) {
                 if ($allWebsites[$siteId]->backup_before_upgrade == 0) {
                     $sitesCheckCompleted[$siteId] = true;
                 }
                 if (isset($sitesCheckCompleted[$siteId])) {
                     continue;
                 }
                 $dir = MainWP_Utility::getMainWPSpecificDir($siteId);
                 //Check if backup ok
                 $lastBackup = -1;
                 if (file_exists($dir) && ($dh = opendir($dir))) {
                     while (($file = readdir($dh)) !== false) {
                         if ($file != '.' && $file != '..') {
                             $theFile = $dir . $file;
                             if (MainWP_Utility::isArchive($file) && !MainWP_Utility::isSQLArchive($file) && filemtime($theFile) > $lastBackup) {
                                 $lastBackup = filemtime($theFile);
                             }
                         }
                     }
                     closedir($dh);
                 }
                 $backupRequired = $lastBackup < time() - 7 * 24 * 60 * 60 ? true : false;
                 if (!$backupRequired) {
                     $sitesCheckCompleted[$siteId] = true;
                     MainWP_Utility::update_option('mainwp_automaticUpdate_backupChecks', $sitesCheckCompleted);
                     continue;
                 }
                 try {
                     $result = MainWP_Manage_Sites::backup($siteId, 'full', '', '', 0, 0, 0, 0);
                     MainWP_Manage_Sites::backupDownloadFile($siteId, 'full', $result['url'], $result['local']);
                     $sitesCheckCompleted[$siteId] = true;
                     MainWP_Utility::update_option('mainwp_automaticUpdate_backupChecks', $sitesCheckCompleted);
                 } catch (Exception $e) {
                     $sitesCheckCompleted[$siteId] = false;
                     MainWP_Utility::update_option('mainwp_automaticUpdate_backupChecks', $sitesCheckCompleted);
                 }
             }
         } else {
             $sitesCheckCompleted = null;
         }
         //Update plugins
         foreach ($pluginsToUpdateNow as $websiteId => $slugs) {
             if ($sitesCheckCompleted != null && $sitesCheckCompleted[$websiteId] == false) {
                 continue;
             }
             try {
                 MainWP_Utility::fetchUrlAuthed($allWebsites[$websiteId], 'upgradeplugintheme', array('type' => 'plugin', 'list' => urldecode(implode(',', $slugs))));
                 if (isset($information['sync']) && !empty($information['sync'])) {
                     MainWP_Sync::syncInformationArray($allWebsites[$websiteId], $information['sync']);
                 }
             } catch (Exception $e) {
             }
         }
         //Update themes
         foreach ($themesToUpdateNow as $websiteId => $slugs) {
             if ($sitesCheckCompleted != null && $sitesCheckCompleted[$websiteId] == false) {
                 continue;
             }
             try {
                 MainWP_Utility::fetchUrlAuthed($allWebsites[$websiteId], 'upgradeplugintheme', array('type' => 'theme', 'list' => urldecode(implode(',', $slugs))));
                 if (isset($information['sync']) && !empty($information['sync'])) {
                     MainWP_Sync::syncInformationArray($allWebsites[$websiteId], $information['sync']);
                 }
             } catch (Exception $e) {
             }
         }
         //Update core
         foreach ($coreToUpdateNow as $websiteId) {
             if ($sitesCheckCompleted != null && $sitesCheckCompleted[$websiteId] == false) {
                 continue;
             }
             try {
                 MainWP_Utility::fetchUrlAuthed($allWebsites[$websiteId], 'upgrade');
             } catch (Exception $e) {
             }
         }
         do_action('mainwp_cronupdatecheck_action', $pluginsNewUpdate, $pluginsToUpdate, $pluginsToUpdateNow, $themesNewUpdate, $themesToUpdate, $themesToUpdateNow, $coreNewUpdate, $coreToUpdate, $coreToUpdateNow);
     }
 }
开发者ID:reeslo,项目名称:mainwp,代码行数:101,代码来源:class-mainwp-system.php

示例2: checkBackups

 public static function checkBackups()
 {
     //if (get_option('mainwp_backup_before_upgrade') != 1) return true;
     if (!is_array($_POST['sites'])) {
         return true;
     }
     $global_backup_before_upgrade = get_option('mainwp_backup_before_upgrade');
     $output = array();
     foreach ($_POST['sites'] as $siteId) {
         $website = MainWP_DB::Instance()->getWebsiteById($siteId);
         if ($website->backup_before_upgrade == 0 || $website->backup_before_upgrade == 2 && $global_backup_before_upgrade == 0) {
             continue;
         }
         $dir = MainWP_Utility::getMainWPSpecificDir($siteId);
         //Check if backup ok
         $lastBackup = -1;
         if (file_exists($dir) && ($dh = opendir($dir))) {
             while (($file = readdir($dh)) !== false) {
                 if ($file != '.' && $file != '..') {
                     $theFile = $dir . $file;
                     if (MainWP_Utility::isArchive($file) && !MainWP_Utility::isSQLArchive($file) && filemtime($theFile) > $lastBackup) {
                         $lastBackup = filemtime($theFile);
                     }
                 }
             }
             closedir($dh);
         }
         $output['sites'][$siteId] = $lastBackup < time() - 7 * 24 * 60 * 60 ? false : true;
     }
     return $output;
 }
开发者ID:senlin,项目名称:mainwp,代码行数:31,代码来源:widget-mainwp-right-now.php

示例3: column_backup

 function column_backup($item)
 {
     $backupnow_lnk = apply_filters('mainwp-managesites-getbackuplink', '', $item['id']);
     if (!empty($backupnow_lnk)) {
         return $backupnow_lnk;
     }
     $dir = MainWP_Utility::getMainWPSpecificDir($item['id']);
     $lastbackup = 0;
     if (file_exists($dir) && ($dh = opendir($dir))) {
         while (($file = readdir($dh)) !== false) {
             if ($file != '.' && $file != '..') {
                 $theFile = $dir . $file;
                 if (MainWP_Utility::isArchive($file) && !MainWP_Utility::isSQLArchive($file)) {
                     if (filemtime($theFile) > $lastbackup) {
                         $lastbackup = filemtime($theFile);
                     }
                 }
             }
         }
         closedir($dh);
     }
     $output = '';
     if ($lastbackup > 0) {
         $output = MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($lastbackup)) . '<br />';
     } else {
         $output = '<span class="mainwp-red">Never</span><br/>';
     }
     if (mainwp_current_user_can('dashboard', 'execute_backups')) {
         $output .= sprintf('<a href="admin.php?page=managesites&backupid=%s">' . '<i class="fa fa-hdd-o"></i> ' . __('Backup Now', 'mainwp') . '</a>', $item['id']);
     }
     return $output;
 }
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:32,代码来源:table-mainwp-manage-sites-list-table.php

示例4: showBackups

 public static function showBackups(&$website)
 {
     $dir = MainWP_Utility::getMainWPSpecificDir($website->id);
     if (!file_exists($dir . 'index.php')) {
         @touch($dir . 'index.php');
     }
     $dbBackups = array();
     $fullBackups = array();
     if (file_exists($dir) && ($dh = opendir($dir))) {
         while (($file = readdir($dh)) !== false) {
             if ($file != '.' && $file != '..') {
                 $theFile = $dir . $file;
                 if (MainWP_Utility::isSQLFile($file)) {
                     $dbBackups[filemtime($theFile) . $file] = $theFile;
                 } else {
                     if (MainWP_Utility::isArchive($file)) {
                         $fullBackups[filemtime($theFile) . $file] = $theFile;
                     }
                 }
             }
         }
         closedir($dh);
     }
     krsort($dbBackups);
     krsort($fullBackups);
     MainWP_Manage_Sites_View::showBackups($website, $fullBackups, $dbBackups);
 }
开发者ID:reeslo,项目名称:mainwp,代码行数:27,代码来源:page-mainwp-manage-sites.php


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