示例#1
0
 /**
  * Purge backups.
  *
  * The function purges all failed and unfinished backups if there are backups more recent then them.
  * Deletes local files and Google Drive files if there are more than the wanted number.
  * If both the local and Drive files have been removed then the log file is deleted as well as
  * all accounts of that backup.
  */
 private function purge_backups()
 {
     $count_local = 0;
     $count_drive = 0;
     $found = false;
     foreach (array_reverse($this->options['backup_list']) as $key => $backup) {
         if (1 == $backup['status']) {
             if (!empty($backup['file_path'])) {
                 $count_local++;
             }
             if (!empty($backup['drive_id'])) {
                 $count_drive++;
             }
             $found = true;
         } elseif ($found) {
             unset($this->options['backup_list'][$key]);
             if (!empty($backup['file_path'])) {
                 delete_path($backup['file_path']);
             }
             if (is_gdocs($this->gdocs) && !empty($backup['drive_id'])) {
                 $this->gdocs->delete_resource($backup['drive_id']);
             }
             delete_path($backup['log']);
             continue;
         }
         if ($count_local > $this->options['local_number']) {
             delete_path($this->options['backup_list'][$key]['file_path']);
             $this->options['backup_list'][$key]['file_path'] = '';
         }
         if (is_gdocs($this->gdocs) && $count_drive > $this->options['drive_number']) {
             $this->gdocs->delete_resource($this->options['backup_list'][$key]['drive_id']);
             $this->options['backup_list'][$key]['drive_id'] = '';
         }
         if (empty($this->options['backup_list'][$key]['file_path']) && empty($this->options['backup_list'][$key]['drive_id'])) {
             delete_path($this->options['backup_list'][$key]['log']);
             unset($this->options['backup_list'][$key]);
         }
     }
 }
	</tr>
	<?php 
foreach ($results as $row) {
    ?>
		<tr>
			<td><?php 
    echo $row->NO_ANGGOTA;
    ?>
</td>
			<td><?php 
    echo $row->NAMA_ANGGOTA;
    ?>
</td>
			<td><?php 
    echo $row->ALAMAT_RUMAH;
    ?>
</td>
			<td><?php 
    echo $row->NO_TLP;
    ?>
</td>
		<td>
		<?php 
    echo delete_path('anggota', $row->ID, $row->NAMA_ANGGOTA) . ' | ' . edit_path('anggota', $row->ID);
    ?>
		</td>
	</tr>
	<?php 
}
?>
</table>
<h2>Klasifikasi</h2>
<?php 
echo add_path('klasifikasi');
echo $this->session->flashdata('notice');
echo table_open_tag('cellpadding=\\"5\\" cellspacing=\\"0\\"');
$title = array('No', 'ID', 'Nama Klasifikasi', 'Aksi');
echo table_title($title);
$no = 1;
foreach ($results as $row) {
    $data = array($no, $row->KLASIFIKASI_ID, $row->NAMA_KLASIFIKASI, delete_path('klasifikasi', $row->ID, $row->NAMA_KLASIFIKASI) . ' | ' . edit_path('klasifikasi', $row->ID));
    echo table_contents($data);
    $no++;
}
echo table_close_tag();
if (empty($results)) {
    echo "Data tidak ditemukan..";
}
示例#4
0
 /**
  * Delete filesystem files and directories.
  *
  * Code taken from WP_Filesystem_Direct class.
  *
  * @param  string  $file      Path to the file or directory to delete.
  * @param  boolean $recursive Descend into subdirectories? Defaults to FALSE.
  * @return boolean            Returns TRUE on success, FALSE on failure.
  */
 function delete_path($file, $recursive = false)
 {
     if (empty($file)) {
         //Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem.
         return false;
     }
     $file = str_replace('\\', '/', $file);
     //for win32, occasional problems deleting files otherwise
     if (@is_file($file)) {
         return @unlink($file);
     }
     if (!$recursive && @is_dir($file)) {
         return @rmdir($file);
     }
     //At this point its a folder, and we're in recursive mode
     $file = trailingslashit($file);
     $filelist = directory_list($file, true);
     $retval = true;
     if (is_array($filelist)) {
         //false if no files, So check first.
         foreach ($filelist as $filename) {
             if (!delete_path($filename, $recursive)) {
                 $retval = false;
             }
         }
     }
     if (file_exists($file) && !@rmdir($file)) {
         $retval = false;
     }
     return $retval;
 }
示例#5
0
<?php

if (!defined('WP_UNINSTALL_PLUGIN')) {
    exit;
}
// Load helper functions
require_once 'functions.php';
// Clear scheduled hook.
if (wp_next_scheduled('backup_schedule')) {
    wp_clear_scheduled_hook('backup_schedule');
}
// Delete all files created by the plugin.
if (defined('BACKUP_LOCAL_FOLDER')) {
    $folder = BACKUP_LOCAL_FOLDER;
} else {
    $options = get_option('backup_options');
    $folder = $options['local_folder'];
}
$folder = absolute_path($folder, ABSPATH);
if (@file_exists($folder . '/.backup')) {
    delete_path($folder, true);
}
// Delete options.
delete_option('backup_options');
示例#6
0
function delete_member($email)
{
    if (isset($email) && $email != '') {
        $path = realpath($_SERVER['DOCUMENT_ROOT']) . '/member/' . $email;
        delete_path($path);
    }
}
示例#7
0
 private function on_delete()
 {
     json_fail(1, "deletion disabled", !$this->options["delete"]["enabled"]);
     $hrefs = use_request_param("hrefs");
     $hrefs = explode("|:|", trim($hrefs));
     $errors = array();
     foreach ($hrefs as $href) {
         $d = normalize_path(dirname($href), true);
         $n = basename($href);
         if ($this->app->is_managed_url($d) && !$this->app->is_hidden($n)) {
             $path = $this->app->to_path($href);
             if (!delete_path($path, true)) {
                 $errors[] = $href;
             }
         }
     }
     json_fail(2, "deletion failed for some", count($errors) > 0);
     json_exit();
 }