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


PHP MainWP_Utility::isSQLArchive方法代码示例

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


在下文中一共展示了MainWP_Utility::isSQLArchive方法的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: backupDownloadFile

 public static function backupDownloadFile($pSiteId, $pType, $pUrl, $pFile)
 {
     $dir = dirname($pFile) . '/';
     @mkdir($dir, 0777, true);
     if (!file_exists($dir . 'index.php')) {
         @touch($dir . 'index.php');
     }
     //Clean old backups from our system
     $maxBackups = get_option('mainwp_backupsOnServer');
     if ($maxBackups === false) {
         $maxBackups = 1;
     }
     $dbBackups = array();
     $fullBackups = array();
     if (file_exists($dir) && ($dh = opendir($dir))) {
         while (($file = readdir($dh)) !== false) {
             if ($file != '.' && $file != '..') {
                 $theFile = $dir . $file;
                 if ($pType == 'db' && MainWP_Utility::isSQLFile($file)) {
                     $dbBackups[filemtime($theFile) . $file] = $theFile;
                 }
                 if ($pType == 'full' && MainWP_Utility::isArchive($file) && !MainWP_Utility::isSQLArchive($file)) {
                     $fullBackups[filemtime($theFile) . $file] = $theFile;
                 }
             }
         }
         closedir($dh);
     }
     krsort($dbBackups);
     krsort($fullBackups);
     $cnt = 0;
     foreach ($dbBackups as $key => $dbBackup) {
         $cnt++;
         if ($cnt >= $maxBackups) {
             @unlink($dbBackup);
         }
     }
     $cnt = 0;
     foreach ($fullBackups as $key => $fullBackup) {
         $cnt++;
         if ($cnt >= $maxBackups) {
             @unlink($fullBackup);
         }
     }
     $website = MainWP_DB::Instance()->getWebsiteById($pSiteId);
     MainWP_Utility::endSession();
     $what = null;
     if ($pType == 'db') {
         MainWP_Utility::downloadToFile(MainWP_Utility::getGetDataAuthed($website, $pUrl, 'fdl'), $pFile, false, $website->http_user, $website->http_pass);
     }
     if ($pType == 'full') {
         MainWP_Utility::downloadToFile(MainWP_Utility::getGetDataAuthed($website, $pUrl, 'fdl'), $pFile, false, $website->http_user, $website->http_pass);
     }
     return true;
 }
开发者ID:reeslo,项目名称:mainwp,代码行数:55,代码来源:page-mainwp-manage-sites.php


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