fixed source code for php74 compatibility

This commit is contained in:
hyung-hwan 2020-02-06 06:40:13 +00:00
parent 7676695ed2
commit 1e8cab123d
4 changed files with 24 additions and 10 deletions

View File

@ -83,7 +83,7 @@ INSTALLATION ON CENTOS
database_username = "root"
database_password = ""
database_name = "codepot"
database_driver = "mysql"
database_driver = "mysqli"
database_prefix = ""
5. Add a local user using the 'codepot-user' command. This command is used
@ -135,6 +135,15 @@ INSTALLATION ON CENTOS
$ ls -lZd /var/cache/codepot
drwxr-xr-x apache apache system_u:object_r:httpd_sys_content_t /var/cache/codepot
The following commands may help.
$ chcon -R -t httpd_sys_content_t /var/lib/codepot
$ chcon -R -t httpd_sys_content_t /var/cache/codepot
If it doesn't work with 'httpd_sys_content_t', you may require 'httpd_sys_content_rw_t'.
$ chcon -R -t httpd_sys_content_rw_t /var/lib/codepot
$ chcon -R -t httpd_sys_content_rw_t /var/cache/codepot
10. If you have SELinux on in the enforcing mode, ensure to allow httpd to
execute an external command.

View File

@ -19,7 +19,7 @@ class CodeRepoModel extends Model
return $this->errmsg;
}
function _scandir ($dir)
static function _scandir ($dir)
{
$files = array ();
@ -33,22 +33,27 @@ class CodeRepoModel extends Model
return $files;
}
function deleteDirectory($dir)
static function _deleteDirectory($dir)
{
if (is_link($dir)) return @unlink($dir);
if (!file_exists($dir)) return TRUE;
if (!is_dir($dir)) return @unlink($dir);
foreach ($this->_scandir($dir) as $item)
foreach (self::_scandir($dir) as $item)
{
if ($item == '.' || $item == '..') continue;
if ($this->deleteDirectory($dir . "/" . $item) === FALSE)
if (self::_deleteDirectory($dir . "/" . $item) === FALSE)
{
chmod($dir . "/" . $item, 0777);
if ($this->deleteDirectory($dir . "/" . $item) === FALSE) return FALSE;
if (self::deleteDirectory($dir . "/" . $item) === FALSE) return FALSE;
};
}
return rmdir($dir);
}
function deleteDirectory($dir)
{
return self::_deleteDirectory($dir);
}
}

View File

@ -867,7 +867,7 @@ class SubversionModel extends CodeRepoModel
$listing[$index]["rev1lineno"] = 0;
$listing[$index]["rev2lineno"] = 0;
$mod = $line{0};
$mod = $line[0];
$line = rtrim(substr($line, 1), "\r\n");
if ($ent) $line = replaceEntities($line, $rep);
@ -2247,7 +2247,7 @@ class SubversionModel extends CodeRepoModel
static function deleteRepo ($projectid, $repodir)
{
return $this->deleteDirectory("{$repodir}/{$projectid}");
return self::_deleteDirectory("{$repodir}/{$projectid}");
}
}

View File

@ -179,7 +179,7 @@ class CI_Input {
}
// We strip slashes if magic quotes is on to keep things consistent
if (get_magic_quotes_gpc())
if ((!defined('PHP_MAJOR_VERSION') || (defined('PHP_MAJOR_VERSION') && PHP_MAJOR_VERSION < 7)) && get_magic_quotes_gpc())
{
$str = stripslashes($str);
}