本文整理汇总了PHP中Ftp::isNeeded方法的典型用法代码示例。如果您正苦于以下问题:PHP Ftp::isNeeded方法的具体用法?PHP Ftp::isNeeded怎么用?PHP Ftp::isNeeded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ftp
的用法示例。
在下文中一共展示了Ftp::isNeeded方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: die
die($error);
}
if (isset($_REQUEST['backup'])) {
require_once '../Updater.php';
$updater = new Updater('google-adsense');
$updater->backup();
exit;
}
if (empty($_FILES)) {
http_response_code(400);
die("File upload error. No files reached the server!");
}
$ds = DIRECTORY_SEPARATOR;
$target = realpath("..{$ds}..") . $ds;
$ftp = new Ftp();
if (Ftp::isNeeded($target)) {
if (!$ftp->isReady) {
$error = "Cannot overwrite the plugin files! Here are your options to proceed." . "<ul><li>Enter or edit the FTP credentials below, if available. Contact your server admin for details.</li>" . "<li>Disable and delete the current version of the plugin, and use the WordPress interface <ol><li>Plugins → Add New</li><li>Click on <code>Upload Plugin</code></li><li>Choose the downloaded zip file</li><li>Click on Insall Now.</li></ol></li>" . "<li>Unpack the downloaded zip file and upload the rest to your server, overwriting the existing files.</li>" . "<li>Make your installation updatable by using this Unix command or equivalent:<pre><code>chmod -R 777 {$target}</code></pre></li></ul>";
http_response_code(400);
die($error);
}
}
$warning = '';
$dirCount = 0;
$zip = new ZipArchive();
$tmpName = $_FILES['file']['tmp_name'];
if ($zip->open($tmpName) !== TRUE) {
$error = "Cannot open the uploaded zip file.";
http_response_code(400);
die($error);
}