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


PHP TaskPermission::canBackup方法代码示例

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


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

示例1: restore_backup

 public function restore_backup()
 {
     $tp = new TaskPermission();
     if (!$tp->canBackup()) {
         return false;
     }
     $file = $this->post('backup_file');
     $db = Loader::db();
     chmod(DIR_FILES_BACKUPS . '/' . $file, 0666);
     $str_restSql = file_get_contents(DIR_FILES_BACKUPS . '/' . $file);
     if (!$str_restSql) {
         $this->set("error", array("There was an error trying to restore the database. This file was empty."));
         $this->view();
         return false;
     }
     $crypt = Loader::helper('encryption');
     if (!preg_match('/INSERT/m', $str_restSql) && !preg_match('/CREATE/m', $str_restSql)) {
         $str_restSql = $crypt->decrypt($str_restSql);
     }
     $arr_sqlStmts = explode("\n\n", $str_restSql);
     foreach ($arr_sqlStmts as $str_stmt) {
         if (trim($str_stmt) != "") {
             $res_restoration = $db->execute($str_stmt);
             if (!$res_restoration) {
                 $this->set("error", array("There was an error trying to restore the database. In query {$str_stmt}"));
                 return;
             }
         }
     }
     $this->set("message", "Restoration Sucessful");
     //reset perms for security!
     chmod(DIR_FILES_BACKUPS . '/' . $file, 00);
     Cache::flush();
     $this->view();
 }
开发者ID:homer6,项目名称:concrete5-mirror,代码行数:35,代码来源:backup.php

示例2: view

 public function view()
 {
     $tp = new TaskPermission();
     if ($tp->canBackup()) {
         $fh = Loader::helper('file');
         $arr_bckups = @$fh->getDirectoryContents(DIR_FILES_BACKUPS);
         $arr_backupfileinfo = array();
         if (count($arr_bckups) > 0) {
             foreach ($arr_bckups as $bkupfile) {
                 // This will ignore files that do not match the created backup pattern of including a timestamp in the filename
                 if (preg_match("/_([\\d]{10,})/", $bkupfile, $timestamp)) {
                     $arr_backupfileinfo[] = array("file" => $bkupfile, "date" => date("Y-m-d H:i:s", $timestamp[1]));
                 }
             }
             // The whole reason this file's overriden - sort these backups chronologically
             uasort($arr_backupfileinfo, function ($a, $b) {
                 return strcmp($b['date'], $a['date']);
             });
             $this->set('backups', $arr_backupfileinfo);
         }
     }
 }
开发者ID:r-bansal,项目名称:janeswalk-web-1,代码行数:22,代码来源:backup.php

示例3: function

$(document).ready( function() { 
   $('a.dialog-launch').click( function() {
      $.fn.dialog.open({ href: $(this).attr('href'),modal:false });

      return false;
      
   });
});

</script>

<div style="width: 760px">

<?php 
$tp = new TaskPermission();
if ($tp->canBackup()) {
    ?>

<h1><span><?php 
    echo t('Existing Backups');
    ?>
</span></h1>
<div class="ccm-dashboard-inner">
<?php 
    if (count($backups) > 0) {
        ?>
<br/>
<table class="grid-list" cellspacing="1" cellpadding="0" border="0">
<tr>
   <td class="subheader"><?php 
        echo t('Date');
开发者ID:VonUniGE,项目名称:concrete5-1,代码行数:31,代码来源:backup.php

示例4: restore_backup

 public function restore_backup()
 {
     set_time_limit(0);
     $tp = new TaskPermission();
     if (!$tp->canBackup()) {
         return false;
     }
     $file = basename(realpath(DIR_FILES_BACKUPS . '/' . $this->post('backup_file')));
     $fh = Loader::helper('file');
     $db = Loader::db();
     if (!file_exists(DIR_FILES_BACKUPS . '/' . $file)) {
         throw new Exception(t('Invalid backup file specified.'));
     }
     chmod(DIR_FILES_BACKUPS . '/' . $file, 0666);
     $str_restSql = $fh->getContents(DIR_FILES_BACKUPS . '/' . $file);
     if (!$str_restSql) {
         $this->error->add(t("There was an error trying to restore the database. This file was empty."));
         $this->view();
         return false;
     }
     $crypt = Loader::helper('encryption');
     if (!preg_match('/INSERT/m', $str_restSql) && !preg_match('/CREATE/m', $str_restSql)) {
         $str_restSql = $crypt->decrypt($str_restSql);
     }
     $arr_sqlStmts = explode("\n\n", $str_restSql);
     foreach ($arr_sqlStmts as $str_stmt) {
         if (trim($str_stmt) != "") {
             $res_restoration = $db->execute($str_stmt);
             if (!$res_restoration) {
                 $this->error->add(t("There was an error trying to restore the database. Affected query: %s", $str_stmt));
                 $this->view();
                 return false;
             }
         }
     }
     //reset perms for security!
     chmod(DIR_FILES_BACKUPS . '/' . $file, 00);
     Cache::flush();
     $this->redirect('/dashboard/system/backup_restore/backup', 'restoration_successful');
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:40,代码来源:backup.php


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