Changeset 29665


Ignore:
Timestamp:
Sep 20, 2014, 1:43:01 PM (10 years ago)
Author:
plg
Message:
  • feature 3142: upgrade script to Piwigo 2.7
  • link to Tour 2_7_0 at the end of upgrade
  • activate plugin Take a Tour by default
Location:
trunk
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions_install.inc.php

    r26946 r29665  
    8989
    9090/**
     91 * Automatically activate some core plugins
     92 */
     93function activate_core_plugins()
     94{
     95  include_once(PHPWG_ROOT_PATH.'admin/include/plugins.class.php');
     96 
     97  $plugins = new plugins();
     98
     99  foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
     100  {
     101    if (in_array($plugin_id, array('TakeATour')))
     102    {
     103      $plugins->perform_action('activate', $plugin_id);
     104    }
     105  }
     106}
     107
     108/**
    91109 * Connect to database during installation. Uses $_POST.
    92110 *
  • trunk/admin/themes/default/template/upgrade.tpl

    r29194 r29665  
    4141  min-height:0;
    4242  border:none;
     43  margin:1em auto;
    4344}
    4445
     
    104105  background-color:#ff7700;
    105106  color:white;
     107  text-decoration:none;
    106108}
    107109
     
    215217
    216218<p>
    217   <a class="bigButton" href="index.php">{'Home'|@translate}</a>
     219  <a class="bigButton" href="{$button_link}">{$button_label}</a>
    218220</p>
    219221{/if}
  • trunk/include/functions.inc.php

    r29008 r29665  
    15131513  $dirname .= 'language/';
    15141514
    1515   $default_language = defined('PHPWG_INSTALLED') ?
     1515  $default_language = defined('PHPWG_INSTALLED') and !defined('UPGRADES_PATH') ?
    15161516      get_default_language() : PHPWG_DEFAULT_LANGUAGE;
    15171517
  • trunk/install.php

    r29270 r29665  
    367367    }
    368368    activate_core_themes();
     369    activate_core_plugins();
    369370
    370371    $insert = array(
  • trunk/install/upgrade_2.5.0.php

    r26461 r29665  
    122122
    123123// now we upgrade from 2.6.0
    124 // include_once(PHPWG_ROOT_PATH.'install/upgrade_2.6.0.php');
     124include_once(PHPWG_ROOT_PATH.'install/upgrade_2.6.0.php');
    125125?>
  • trunk/upgrade.php

    r28207 r29665  
    139139include(PHPWG_ROOT_PATH . 'admin/include/languages.class.php');
    140140$languages = new languages('utf-8');
    141 
    142141if (isset($_GET['language']))
    143142{
     
    208207load_language( 'install.lang', '', array('language'=>$language, 'target_charset'=>'utf-8', 'no_fallback' => true) );
    209208load_language( 'upgrade.lang', '', array('language'=>$language, 'target_charset'=>'utf-8', 'no_fallback' => true) );
    210 
    211209// check php version
    212210if (version_compare(PHP_VERSION, REQUIRED_PHP_VERSION, '<'))
     
    340338  $current_release = '2.4.0';
    341339}
     340else if (!in_array('nb_available_tags', $columns_of[PREFIX_TABLE.'user_cache']))
     341{
     342  $current_release = '2.5.0';
     343}
    342344else
    343345{
     
    349351  $applied_upgrades = array_from_query($query, 'id');
    350352
    351   if (!in_array(139, $applied_upgrades))
    352   {
    353     $current_release = '2.5.0';
     353  if (!in_array(144, $applied_upgrades))
     354  {
     355    $current_release = '2.6.0';
    354356  }
    355357  else
     
    380382  if (is_file($upgrade_file))
    381383  {
     384    // reset SQL counters
     385    $page['queries_time'] = 0;
     386    $page['count_queries'] = 0;
     387   
    382388    $page['upgrade_start'] = get_moment();
    383389    $conf['die_on_sql_error'] = false;
     
    439445    $page['infos'] = array();
    440446
    441     /* might be usefull when we will have a real integrity checker
    442     $query = '
    443 REPLACE INTO '.PLUGINS_TABLE.'
    444   (id, state)
    445   VALUES (\'c13y_upgrade\', \'active\')
    446 ;';
    447     pwg_query($query);*/
    448 
    449447    $query = '
    450448REPLACE INTO '.PLUGINS_TABLE.'
     
    454452    pwg_query($query);
    455453
     454    $template->assign(
     455      array(
     456        'button_label' => l10n('Home'),
     457        'button_link' => 'index.php',
     458        )
     459      );
     460
     461    // if the webmaster has a session, let's give a link to discover new features
     462    if (!empty($_SESSION['pwg_uid']))
     463    {
     464      $version_ = str_replace('.', '_', get_branch_from_version(PHPWG_VERSION).'.0');
     465     
     466      if (file_exists(PHPWG_PLUGINS_PATH .'TakeATour/tours/'.$version_.'/config.inc.php'))
     467      {
     468        load_language(
     469          'plugin.lang',
     470          PHPWG_PLUGINS_PATH.'TakeATour/',
     471          array(
     472            'language' => $language,
     473            'force_fallback'=>'en_UK',
     474            )
     475          );
     476
     477        // we need the secret key for get_pwg_token()
     478        load_conf_from_db();
     479       
     480        $template->assign(
     481          array(
     482            'button_label' => l10n('2_7_0_descrp'), // TODO avoid to update it on each release
     483            'button_link' => 'admin.php?submited_tour_path=tours/'.$version_.'&amp;pwg_token='.get_pwg_token(),
     484            )
     485          );
     486      }
     487    }
     488
    456489    // Delete cache data
    457490    invalidate_user_cache(true);
Note: See TracChangeset for help on using the changeset viewer.