Replace FileHandler calls and other paths in Rhymix Framework

This commit is contained in:
Kijin Sung 2016-03-18 21:03:22 +09:00
parent 89bd526a13
commit 740de5caf3
9 changed files with 39 additions and 37 deletions

View file

@ -19,9 +19,9 @@ class ConfigParser
public static function convert()
{
// Load DB info file.
if (file_exists(RX_BASEDIR . Config::$old_db_config_filename))
if (file_exists(\RX_BASEDIR . Config::$old_db_config_filename))
{
include RX_BASEDIR . Config::$old_db_config_filename;
include \RX_BASEDIR . Config::$old_db_config_filename;
}
else
{
@ -29,16 +29,16 @@ class ConfigParser
}
// Load FTP info file.
if (file_exists(RX_BASEDIR . Config::$old_ftp_config_filename))
if (file_exists(\RX_BASEDIR . Config::$old_ftp_config_filename))
{
include RX_BASEDIR . Config::$old_ftp_config_filename;
include \RX_BASEDIR . Config::$old_ftp_config_filename;
}
// Load selected language file.
if (file_exists(RX_BASEDIR . Config::$old_lang_config_filename))
if (file_exists(\RX_BASEDIR . Config::$old_lang_config_filename))
{
$lang_selected = array();
$lang_selected_raw = file_get_contents(RX_BASEDIR . Config::$old_lang_config_filename);
$lang_selected_raw = file_get_contents(\RX_BASEDIR . Config::$old_lang_config_filename);
$lang_selected_raw = array_map('trim', explode("\n", $lang_selected_raw));
foreach ($lang_selected_raw as $lang_selected_item)
{
@ -59,7 +59,7 @@ class ConfigParser
}
// Load defaults for the new configuration.
$config = (include RX_BASEDIR . Config::$default_config_filename);
$config = (include \RX_BASEDIR . Config::$default_config_filename);
// Convert database configuration.
if (!isset($db_info->master_db))
@ -184,7 +184,7 @@ class ConfigParser
{
$default_url = \Context::decodeIdna($default_url);
}
$config['url']['default'] = $default_url ?: (RX_SSL ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . \RX_BASEURL;
$config['url']['default'] = $default_url ?: (\RX_SSL ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . \RX_BASEURL;
$config['url']['http_port'] = $db_info->http_port ?: null;
$config['url']['https_port'] = $db_info->https_port ?: null;
$config['url']['ssl'] = $db_info->use_ssl ?: 'none';

View file

@ -3,6 +3,7 @@
namespace Rhymix\Framework\Parsers;
use Rhymix\Framework\Lang;
use Rhymix\Framework\Storage;
/**
* Lang parser class for XE compatibility.
@ -32,7 +33,7 @@ class LangParser
foreach ($files as $filename)
{
$new_filename = preg_replace('/\.lang\.php$/', '.php', str_replace('jp.lang', 'ja.lang', $filename));
\FileHandler::rename($filename, $new_filename);
Storage::move($filename, $new_filename);
}
}
}
@ -49,7 +50,7 @@ class LangParser
// Check if the cache file already exists.
if ($output_filename === null)
{
$output_filename = RX_BASEDIR . 'files/cache/lang/' . md5($filename) . '.' . $language . '.php';
$output_filename = \RX_BASEDIR . 'files/cache/lang/' . md5($filename) . '.' . $language . '.php';
if (file_exists($output_filename) && filemtime($output_filename) > filemtime($filename))
{
return $output_filename;
@ -60,7 +61,7 @@ class LangParser
$xml = @simplexml_load_file($filename);
if ($xml === false)
{
\FileHandler::writeFile($output_filename, '');
Storage::write($output_filename, '');
return false;
}
@ -95,7 +96,7 @@ class LangParser
$buff .= '$lang->' . $key . ' = ' . var_export($value, true) . ";\n";
}
}
\FileHandler::writeFile($output_filename, $buff);
Storage::write($output_filename, $buff);
return $output_filename;
}