s/is_writeable/is_writable/g

This commit is contained in:
joyqi 2022-04-07 17:31:32 +08:00
parent bad3ef651d
commit 53eda2cf75
5 changed files with 8 additions and 8 deletions

View File

@ -759,7 +759,7 @@ function install_step_1_perform()
$realUploadDir = \Typecho\Common::url($uploadDir, __TYPECHO_ROOT_DIR__);
$writeable = true;
if (is_dir($realUploadDir)) {
if (!is_writeable($realUploadDir) || !is_readable($realUploadDir)) {
if (!is_writable($realUploadDir) || !is_readable($realUploadDir)) {
if (!@chmod($realUploadDir, 0755)) {
$writeable = false;
}

View File

@ -103,7 +103,7 @@ class Upgrade
*/
public static function v0_4r9_1_14($db, $options)
{
if (is_writeable(__TYPECHO_ROOT_DIR__ . '/config.inc.php')) {
if (is_writable(__TYPECHO_ROOT_DIR__ . '/config.inc.php')) {
$handle = fopen(__TYPECHO_ROOT_DIR__ . '/config.inc.php', 'ab');
fwrite($handle, '
/** 初始化时区 */
@ -351,7 +351,7 @@ Typecho_Date::setTimezoneOffset($options->timezone);
//创建上传目录
$uploadDir = Common::url(Upload::UPLOAD_DIR, __TYPECHO_ROOT_DIR__);
if (is_dir($uploadDir)) {
if (!is_writeable($uploadDir)) {
if (!is_writable($uploadDir)) {
if (!@chmod($uploadDir, 0755)) {
throw new \Typecho\Widget\Exception(_t('上传目录无法写入, 请手动将安装目录下的 %s 目录的权限设置为可写然后继续升级', Upload::UPLOAD_DIR));
}
@ -530,7 +530,7 @@ Typecho_Date::setTimezoneOffset($options->timezone);
->rows(['name' => 'gzip', 'user' => 0, 'value' => 0]));
if (is_writeable(__TYPECHO_ROOT_DIR__ . '/config.inc.php')) {
if (is_writable(__TYPECHO_ROOT_DIR__ . '/config.inc.php')) {
$contents = file_get_contents(__TYPECHO_ROOT_DIR__ . '/config.inc.php');
$contents = preg_replace("/Common::init([^;]+);/is", "Common::init(array(
'autoLoad' => true,

View File

@ -67,7 +67,7 @@ class Permalink extends Options implements ActionInterface
$hasWrote = false;
if (!file_exists(__TYPECHO_ROOT_DIR__ . '/.htaccess') && strpos(php_sapi_name(), 'apache') !== false) {
if (is_writeable(__TYPECHO_ROOT_DIR__)) {
if (is_writable(__TYPECHO_ROOT_DIR__)) {
$parsed = parse_url($this->options->siteUrl);
$basePath = empty($parsed['path']) ? '/' : $parsed['path'];
$basePath = rtrim($basePath, '/') . '/';
@ -215,7 +215,7 @@ RewriteRule . {$basePath}index.php [L]
if (
strpos(php_sapi_name(), 'apache') !== false
&& !file_exists(__TYPECHO_ROOT_DIR__ . '/.htaccess')
&& !is_writeable(__TYPECHO_ROOT_DIR__)
&& !is_writable(__TYPECHO_ROOT_DIR__)
) {
$errorStr .= '<br /><strong>' . _t('我们检测到你使用了apache服务器, 但是程序无法在根目录创建.htaccess文件, 这可能是产生这个错误的原因.')
. _t('请调整你的目录权限, 或者手动创建一个.htaccess文件.') . '</strong>';

View File

@ -103,7 +103,7 @@ class Edit extends Options implements ActionInterface
$path = $this->options->themeFile($theme, $file);
if (
file_exists($path) && is_writeable($path)
file_exists($path) && is_writable($path)
&& (!defined('__TYPECHO_THEME_WRITEABLE__') || __TYPECHO_THEME_WRITEABLE__)
) {
$handle = fopen($path, 'wb');

View File

@ -120,7 +120,7 @@ class Files extends Base
*/
public function currentIsWriteable(): bool
{
return is_writeable(Options::alloc()
return is_writable(Options::alloc()
->themeFile($this->currentTheme, $this->currentFile))
&& self::isWriteable();
}