upgrade.php
changeset 304 e2cb5f1432c8
parent 279 8acd77a6c19d
parent 297 ee1fc84f12a8
child 310 199b9708f4a2
equal deleted inserted replaced
280:dc08c70ca550 304:e2cb5f1432c8
    11  *
    11  *
    12  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
    12  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
    13  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
    13  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
    14  */
    14  */
    15 
    15 
    16 define('IN_ENANO_INSTALL', 'true');   
    16 define('IN_ENANO_INSTALL', 'true');
       
    17 define('IN_ENANO_UPGRADE', 'true');
    17 
    18 
    18 if(!defined('scriptPath')) {
    19 if(!defined('scriptPath')) {
    19   $sp = dirname($_SERVER['REQUEST_URI']);
    20   $sp = dirname($_SERVER['REQUEST_URI']);
    20   if($sp == '/' || $sp == '\\') $sp = '';
    21   if($sp == '/' || $sp == '\\') $sp = '';
    21   define('scriptPath', $sp);
    22   define('scriptPath', $sp);
    25   $sp = dirname($_SERVER['REQUEST_URI']);
    26   $sp = dirname($_SERVER['REQUEST_URI']);
    26   if($sp == '/' || $sp == '\\') $sp = '';
    27   if($sp == '/' || $sp == '\\') $sp = '';
    27   define('contentPath', $sp);
    28   define('contentPath', $sp);
    28 }
    29 }
    29 
    30 
    30 global $_starttime, $this_page, $sideinfo;
    31 global $this_page, $sideinfo;
    31 $_starttime = microtime(true);
    32 
       
    33 function microtime_float()
       
    34 {
       
    35   list($usec, $sec) = explode(" ", microtime());
       
    36   return ((float)$usec + (float)$sec);
       
    37 }
       
    38 
       
    39 global $_starttime;
       
    40 $_starttime = microtime_float();
    32 
    41 
    33 // Determine directory (special case for development servers)
    42 // Determine directory (special case for development servers)
    34 if ( strpos(__FILE__, '/repo/') && file_exists('.enanodev') )
    43 if ( strpos(__FILE__, '/repo/') && file_exists('.enanodev') )
    35 {
    44 {
    36   $filename = str_replace('/repo/', '/', __FILE__);
    45   $filename = str_replace('/repo/', '/', __FILE__);
    83 $this_version   = '1.1.1';
    92 $this_version   = '1.1.1';
    84 $func_list = Array(
    93 $func_list = Array(
    85     '1.0' => Array('u_1_0_1_update_del_votes'),
    94     '1.0' => Array('u_1_0_1_update_del_votes'),
    86     '1.0b4' => Array('u_1_0_RC1_update_user_ids', 'u_1_0_RC1_add_admins_to_group', 'u_1_0_RC1_alter_files_table', 'u_1_0_RC1_destroy_session_cookie', 'u_1_0_RC1_set_contact_email', 'u_1_0_RC1_update_page_text'), // ,
    95     '1.0b4' => Array('u_1_0_RC1_update_user_ids', 'u_1_0_RC1_add_admins_to_group', 'u_1_0_RC1_alter_files_table', 'u_1_0_RC1_destroy_session_cookie', 'u_1_0_RC1_set_contact_email', 'u_1_0_RC1_update_page_text'), // ,
    87     // '1.0RC2' => Array('u_1_0_populate_userpage_comments')
    96     // '1.0RC2' => Array('u_1_0_populate_userpage_comments')
    88     '1.0RC3' => Array('u_1_0_RC3_make_users_extra')
    97     '1.0RC3' => Array('u_1_0_RC3_make_users_extra'),
       
    98     '1.0.2b1' => Array('u_1_0_2_nuke_template_cache', 'u_1_0_2_rebuild_search_index')
    89   );
    99   );
    90 
   100 
    91 if(!isset($_GET['mode'])) 
   101 if(!isset($_GET['mode'])) 
    92 {
   102 {
    93   $_GET['mode'] = 'login';
   103   $_GET['mode'] = 'login';
   429     return false;
   439     return false;
   430   $sql = "INSERT INTO " . table_prefix . "users_extra(user_id) VALUES$ids;";
   440   $sql = "INSERT INTO " . table_prefix . "users_extra(user_id) VALUES$ids;";
   431   
   441   
   432   if ( !$db->sql_query($sql) )
   442   if ( !$db->sql_query($sql) )
   433     $db->_die();
   443     $db->_die();
       
   444 }
       
   445 
       
   446 function u_1_0_2_nuke_template_cache()
       
   447 {
       
   448   $dir = @opendir(ENANO_ROOT . '/cache');
       
   449   if ( !$dir )
       
   450   {
       
   451     return false;
       
   452   }
       
   453   while ( ($fname = @readdir($dir)) )
       
   454   {
       
   455     if ( preg_match('/\.tpl\.php$/', $fname) )
       
   456     {
       
   457       unlink( ENANO_ROOT . '/cache/' . $fname );
       
   458     }
       
   459   }
       
   460 }
       
   461 
       
   462 function u_1_0_2_rebuild_search_index()
       
   463 {
       
   464   global $paths;
       
   465   @set_time_limit(0);
       
   466   $paths->rebuild_search_index();
   434 }
   467 }
   435 
   468 
   436 switch($_GET['mode'])
   469 switch($_GET['mode'])
   437 {
   470 {
   438   case "login":
   471   case "login":