public function backup() { $options = Sns_Option::get_options(); $backupItems = array(); // self::configureCount( $options[Sns_Option::COUNT]->value ); if ($options[Sns_Option::WP_CONTENT]->value == Sns_Option::SET) { $backupItems[Sns_Option::WP_CONTENT] = WP_CONTENT_DIR; } else { if ($options[Sns_Option::PLUGINS]->value == Sns_Option::SET) { $backupItems[Sns_Option::PLUGINS] = WP_PLUGIN_DIR; } if ($options[Sns_Option::THEMES]->value == Sns_Option::SET) { $backupItems[Sns_Option::THEMES] = get_theme_root(); } } if ($options[Sns_Option::DB]->value == Sns_Option::SET) { $backupItems[Sns_Option::DB] = Sns_Option::SET; } $notification = new Sns_Notification(); try { @session_write_close(); $warns = $this->backup_items($backupItems); Sns_Log::log_msg('[SUCCEED Backup]' . PHP_EOL); $destinations = new Sns_Destination($this->type); $locations = $destinations->get_destinations(); $filePath = SNS_BACKUPS_PATH . $this->filename . '.zip'; if ($locations[Sns_Destination::SETTINGS_FTP]->status == Sns_Destination::SET) { Sns_Log::log_action('Uploading to FTP server'); try { $ftp = new Sns_Ftp(); $ftp->upload($filePath, $this->filename . '.zip'); } catch (Exception $e) { Sns_Exception_Handler::log($e); } Sns_Log::log_action('Uploading to FTP server', SNS_LOG_END); } return $warns; } catch (Exception $e) { Sns_Log::log_exception_obj($e); Sns_Log::log_msg('[FAILED Backup]'); Sns_History::delete_by_hash($this->hash, $this->filename); throw $e; } }
</div> <div id="settings-tab-notifications"> <?php Sns_Notification::draw(); ?> </div> <div id="settings-tab-cloud"> <div id="dropbox-block"> <?php Sns_Dropbox::draw(); ?> </div> <div id="ftp-block"> <?php try { $ftp = new Sns_Ftp(); $ftp->draw(); } catch (Exception $e) { } ?> </div> </div> <div id="settings-tab-log"> <div class="fr"> <button id="log-refresh" type="button" class="btn btn-primary"> <span class="glyphicon glyphicon-refresh"></span> </button> <button id="log-empty" type="button" class="btn btn-default"> <span class="glyphicon glyphicon-trash"></span> </button> </div>
function sns_backup_unlink_ftp() { $ftp = new Sns_Ftp(); $ftp->unlink(); $result = new stdClass(); $result->status = 'OK'; sns_send_response($result); }