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


PHP MainWP_Utility::getRealExtension方法代码示例

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


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

示例1: backup


//.........这里部分代码省略.........
             $maximumFileDescriptors = get_option('mainwp_maximumFileDescriptors');
             $maximumFileDescriptors = $maximumFileDescriptors === false ? 150 : $maximumFileDescriptors;
         }
     } else {
         if ($pArchiveFormat != 'global' && $pMaximumFileDescriptorsOverride == 1) {
             $maximumFileDescriptorsAuto = $pMaximumFileDescriptorsAuto == 1;
             $maximumFileDescriptors = $pMaximumFileDescriptors;
         } else {
             $maximumFileDescriptorsAuto = get_option('mainwp_maximumFileDescriptorsAuto');
             $maximumFileDescriptors = get_option('mainwp_maximumFileDescriptors');
             $maximumFileDescriptors = $maximumFileDescriptors === false ? 150 : $maximumFileDescriptors;
         }
     }
     $file = str_replace(array('%sitename%', '%url%', '%date%', '%time%', '%type%'), array(MainWP_Utility::sanitize($website->name), $websiteCleanUrl, MainWP_Utility::date('m-d-Y'), MainWP_Utility::date('G\\hi\\ms\\s'), $pType), $pFilename);
     $file = str_replace('%', '', $file);
     $file = MainWP_Utility::normalize_filename($file);
     //Normal flow: check site settings & fallback to global
     if ($pLoadFilesBeforeZip == false) {
         $loadFilesBeforeZip = $website->loadFilesBeforeZip;
         if ($loadFilesBeforeZip == 1) {
             $loadFilesBeforeZip = get_option('mainwp_options_loadFilesBeforeZip');
             $loadFilesBeforeZip = $loadFilesBeforeZip == 1 || $loadFilesBeforeZip === false;
         } else {
             $loadFilesBeforeZip = $loadFilesBeforeZip == 2;
         }
     } else {
         if ($pArchiveFormat == 'global' || $pLoadFilesBeforeZip == 1) {
             $loadFilesBeforeZip = get_option('mainwp_options_loadFilesBeforeZip');
             $loadFilesBeforeZip = $loadFilesBeforeZip == 1 || $loadFilesBeforeZip === false;
         } else {
             $loadFilesBeforeZip = $pLoadFilesBeforeZip == 2;
         }
     }
     //Nomral flow: check site settings & fallback to global
     if ($pArchiveFormat == false) {
         $archiveFormat = MainWP_Utility::getCurrentArchiveExtension($website);
     } else {
         if ($pArchiveFormat == 'global') {
             $archiveFormat = MainWP_Utility::getCurrentArchiveExtension();
         } else {
             $archiveFormat = $pArchiveFormat;
         }
     }
     MainWP_Utility::endSession();
     $information = MainWP_Utility::fetchUrlAuthed($website, 'backup', array('type' => $pType, 'exclude' => $pExclude, 'excludebackup' => $excludebackup, 'excludecache' => $excludecache, 'excludenonwp' => $excludenonwp, 'excludezip' => $excludezip, 'ext' => $archiveFormat, 'file_descriptors_auto' => $maximumFileDescriptorsAuto, 'file_descriptors' => $maximumFileDescriptors, 'loadFilesBeforeZip' => $loadFilesBeforeZip, MainWP_Utility::getFileParameter($website) => $file, 'fileUID' => $pFileNameUID, 'pid' => $pid, 'append' => $append ? 1 : 0), false, false, false);
     do_action('mainwp_managesite_backup', $website, array('type' => $pType), $information);
     if (isset($information['error'])) {
         throw new MainWP_Exception($information['error']);
     } else {
         if ($pType == 'db' && !$information['db']) {
             throw new MainWP_Exception('Database backup failed.');
         } else {
             if ($pType == 'full' && !$information['full']) {
                 throw new MainWP_Exception('Full backup failed.');
             } else {
                 if (isset($information['db'])) {
                     if ($information['db'] != false) {
                         $backup_result['url'] = $information['db'];
                         $backup_result['type'] = 'db';
                     } else {
                         if ($information['full'] != false) {
                             $backup_result['url'] = $information['full'];
                             $backup_result['type'] = 'full';
                         }
                     }
                     if (isset($information['size'])) {
                         $backup_result['size'] = $information['size'];
                     }
                     $backup_result['subfolder'] = $subfolder;
                     $dir = MainWP_Utility::getMainWPSpecificDir($pSiteId);
                     $fm_date = MainWP_Utility::sanitize_file_name(MainWP_Utility::date(get_option('date_format')));
                     $fm_time = MainWP_Utility::sanitize_file_name(MainWP_Utility::date(get_option('time_format')));
                     if ($pType == 'db') {
                         $localBackupFile = $dir . 'db-' . $websiteCleanUrl . '-' . $fm_date . '-' . $fm_time . MainWP_Utility::getRealExtension($information['db']);
                         $localRegexFile = 'db-' . $websiteCleanUrl . '-(.*)-(.*).sql(\\.zip|\\.tar|\\.tar\\.gz|\\.tar\\.bz2)?';
                     } else {
                         $localBackupFile = $dir . 'full-' . $websiteCleanUrl . '-' . $fm_date . '-' . $fm_time . MainWP_Utility::getRealExtension($information['full']);
                         $localRegexFile = 'full-' . $websiteCleanUrl . '-(.*)-(.*).(zip|tar|tar.gz|tar.bz2)';
                     }
                     if ($pFilename != null) {
                         $filename = str_replace(array('%sitename%', '%url%', '%date%', '%time%', '%type%'), array(MainWP_Utility::sanitize($website->name), $websiteCleanUrl, $fm_date, $fm_time, $pType), $pFilename);
                         $filename = str_replace('%', '', $filename);
                         $localBackupFile = $dir . $filename;
                         $localBackupFile = MainWP_Utility::normalize_filename($localBackupFile);
                         if ($pType == 'db') {
                             $localBackupFile .= MainWP_Utility::getRealExtension($information['db']);
                         } else {
                             $localBackupFile .= MainWP_Utility::getRealExtension($information['full']);
                         }
                     }
                     $backup_result['local'] = $localBackupFile;
                     $backup_result['regexfile'] = $localRegexFile;
                     return $backup_result;
                 } else {
                     throw new MainWP_Exception('Database backup failed due to an undefined error');
                 }
             }
         }
     }
 }
开发者ID:reeslo,项目名称:mainwp,代码行数:101,代码来源:page-mainwp-manage-sites.php


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