本文整理汇总了PHP中Updater::updateFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Updater::updateFile方法的具体用法?PHP Updater::updateFile怎么用?PHP Updater::updateFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Updater
的用法示例。
在下文中一共展示了Updater::updateFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unlink
}
}
if (!$error) {
unlink($basepath . "/cachefiles/update.zip");
$new_files = $updater->parseDir($basepath . "/cachefiles/update/public_html");
if (count($new_files)) {
foreach ($new_files as $full_path => $file_size) {
if (substr_count($full_path, "vars.php") == 0 && (!isset($_POST['no_language']) || !$_POST['no_language'] || !substr_count($full_path, "/language/")) && (!isset($_POST['no_template']) || !$_POST['no_template'] || !substr_count($full_path, "/templates/"))) {
$sub_path = str_replace($basepath . "/cachefiles/update/public_html", "", $full_path);
$tmp = explode("/", $sub_path);
$file_name = $tmp[count($tmp) - 1];
unset($tmp[count($tmp) - 1]);
$file_path = implode("/", $tmp);
if (!file_exists($basepath . $sub_path)) {
$file_content = file_get_contents($full_path);
$res = $updater->updateFile($ftp_conn, $root_path, $file_content, $file_path, $file_name);
if ($res == 1) {
$updater->upgradeLog("New file: {$sub_path}", true, "Added");
} elseif ($res == 2) {
$updater->upgradeLog("New file: {$sub_path}", false, "Can't create folder");
} else {
$updater->upgradeLog("New file: {$sub_path}", false, "Unexpected error");
}
} else {
$new_md5 = md5(file_get_contents($full_path));
$old_md5 = md5(file_get_contents($basepath . $sub_path));
if ($new_md5 != $old_md5) {
$file_content = file_get_contents($full_path);
$res = $updater->updateFile($ftp_conn, $root_path, $file_content, $file_path, $file_name);
if ($res == 1) {
$updater->upgradeLog("File changed: {$sub_path}", true, "Added");