mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-07 09:13:02 +02:00
feature 1630: upgrade to Piwigo 2.1 :-)
bug 1604: only activate core themes not all themes. git-svn-id: http://piwigo.org/svn/trunk@5982 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
* @param string replacing
|
||||
* @return void
|
||||
*/
|
||||
function execute_sqlfile($filepath, $replaced, $replacing)
|
||||
function execute_sqlfile($filepath, $replaced, $replacing, $dblayer)
|
||||
{
|
||||
$sql_lines = file($filepath);
|
||||
$query = '';
|
||||
@@ -54,12 +54,11 @@ function execute_sqlfile($filepath, $replaced, $replacing)
|
||||
// we don't execute "DROP TABLE" queries
|
||||
if (!preg_match('/^DROP TABLE/i', $query))
|
||||
{
|
||||
global $install_charset_collate;
|
||||
if ( !empty($install_charset_collate) )
|
||||
if ('mysql' == $dblayer)
|
||||
{
|
||||
if ( preg_match('/^(CREATE TABLE .*)[\s]*;[\s]*/im', $query, $matches) )
|
||||
{
|
||||
$query = $matches[1].' '.$install_charset_collate.';';
|
||||
$query = $matches[1].' DEFAULT CHARACTER SET utf8'.';';
|
||||
}
|
||||
}
|
||||
pwg_query($query);
|
||||
@@ -125,17 +124,20 @@ function available_engines()
|
||||
}
|
||||
|
||||
/**
|
||||
* Automatically activate all themes in the "themes" directory.
|
||||
* Automatically activate all core themes in the "themes" directory.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function activate_all_themes()
|
||||
function activate_core_themes()
|
||||
{
|
||||
include_once(PHPWG_ROOT_PATH.'admin/include/themes.class.php');
|
||||
$themes = new themes();
|
||||
foreach ($themes->fs_themes as $theme_id => $fs_theme)
|
||||
{
|
||||
$themes->perform_action('activate', $theme_id);
|
||||
if (in_array($theme_id, array('Sylvia', 'clear', 'dark')))
|
||||
{
|
||||
$themes->perform_action('activate', $theme_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,15 +145,15 @@ function install_db_connect(&$infos, &$errors)
|
||||
{
|
||||
try
|
||||
{
|
||||
$pwg_db_link = pwg_db_connect($_POST['dbhost'], $_POST['dbuser'],
|
||||
$_POST['dbpasswd'], $_POST['dbname']);
|
||||
|
||||
return $pwg_db_link;
|
||||
$pwg_db_link = pwg_db_connect($_POST['dbhost'], $_POST['dbuser'], $_POST['dbpasswd'], $_POST['dbname']);
|
||||
if ($pwg_db_link)
|
||||
{
|
||||
pwg_db_check_version();
|
||||
}
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
array_push( $errors, l10n($e->getMessage()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
?>
|
||||
@@ -76,8 +76,6 @@ function deactivate_non_standard_plugins()
|
||||
global $page;
|
||||
|
||||
$standard_plugins = array(
|
||||
'add_index',
|
||||
'admin_advices',
|
||||
'admin_multi_view',
|
||||
'c13y_upgrade',
|
||||
'event_tracer',
|
||||
@@ -221,8 +219,11 @@ function upgrade_db_connect()
|
||||
|
||||
try
|
||||
{
|
||||
$pwg_db_link = pwg_db_connect($conf['db_host'], $conf['db_user'],
|
||||
$conf['db_password'], $conf['db_base']);
|
||||
$pwg_db_link = pwg_db_connect($conf['db_host'], $conf['db_user'], $conf['db_password'], $conf['db_base']);
|
||||
if ($pwg_db_link)
|
||||
{
|
||||
pwg_db_check_version();
|
||||
}
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
@@ -230,4 +231,33 @@ function upgrade_db_connect()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get languages defined in the language directory
|
||||
*/
|
||||
function get_fs_languages($target_charset = null)
|
||||
{
|
||||
if ( empty($target_charset) )
|
||||
{
|
||||
$target_charset = get_pwg_charset();
|
||||
}
|
||||
$target_charset = strtolower($target_charset);
|
||||
|
||||
$dir = opendir(PHPWG_ROOT_PATH.'language');
|
||||
|
||||
while ($file = readdir($dir))
|
||||
{
|
||||
$path = PHPWG_ROOT_PATH.'language/'.$file;
|
||||
if (!is_link($path) and is_dir($path) and file_exists($path.'/iso.txt'))
|
||||
{
|
||||
list($language_name) = @file($path.'/iso.txt');
|
||||
|
||||
$languages[$file] = convert_charset($language_name, $target_charset);
|
||||
}
|
||||
}
|
||||
closedir($dir);
|
||||
@asort($languages);
|
||||
|
||||
return $languages;
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user