本文整理汇总了PHP中MainWP_Utility::getMainWPSpecificDir方法的典型用法代码示例。如果您正苦于以下问题:PHP MainWP_Utility::getMainWPSpecificDir方法的具体用法?PHP MainWP_Utility::getMainWPSpecificDir怎么用?PHP MainWP_Utility::getMainWPSpecificDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWP_Utility
的用法示例。
在下文中一共展示了MainWP_Utility::getMainWPSpecificDir方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mainwp_cronupdatescheck_action
//.........这里部分代码省略.........
$themeConflictsSaved = '';
}
MainWP_Utility::update_option('mainwp_updatescheck_mail_themeconflicts', $themeConflictsSaved . $themeConflicts);
}
if (count($coreToUpdate) == 0 && count($pluginsToUpdate) == 0 && count($themesToUpdate) == 0 && count($ignoredCoreToUpdate) == 0 && count($ignoredCoreNewUpdate) == 0 && $pluginConflicts == '' && $themeConflicts == '') {
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;
}
示例2: 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;
}
示例3: 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;
}
示例4: cleanUpload
public static function cleanUpload()
{
$path = MainWP_Utility::getMainWPSpecificDir('bulk');
if (file_exists($path) && ($dh = opendir($path))) {
while (($file = readdir($dh)) !== false) {
if ($file != '.' && $file != '..') {
@unlink($path . $file);
}
}
closedir($dh);
}
die(json_encode(array('ok' => true)));
}
示例5: getDownloadUrl
public static function getDownloadUrl($what, $filename)
{
$specificDir = MainWP_Utility::getMainWPSpecificDir($what);
$mwpDir = MainWP_Utility::getMainWPDir();
$mwpDir = $mwpDir[0];
$fullFile = $specificDir . $filename;
return admin_url('?sig=' . md5(filesize($fullFile)) . '&mwpdl=' . rawurlencode(str_replace($mwpDir, '', $fullFile)));
}
示例6: 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);
}