upgrade.php
changeset 112 008b1c42be72
parent 110 68e030f8dfa6
child 113 6f357b951f7a
equal deleted inserted replaced
111:b348ace50bc7 112:008b1c42be72
    75     '1.0RC2' => Array('1.0RC3'),
    75     '1.0RC2' => Array('1.0RC3'),
    76     '1.0RC3' => Array('1.0')
    76     '1.0RC3' => Array('1.0')
    77   );
    77   );
    78 $this_version   = '1.0.1';
    78 $this_version   = '1.0.1';
    79 $func_list = Array(
    79 $func_list = Array(
       
    80     '1.0' => Array('u_1_0_1_update_del_votes'),
    80     '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'), // ,
    81     '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'), // ,
    81     // '1.0RC2' => Array('u_1_0_populate_userpage_comments')
    82     // '1.0RC2' => Array('u_1_0_populate_userpage_comments')
    82     '1.0RC3' => Array('u_1_0_RC3_make_users_extra')
    83     '1.0RC3' => Array('u_1_0_RC3_make_users_extra')
    83   );
    84   );
    84 
    85 
   351     if(!$db->sql_query($query))
   352     if(!$db->sql_query($query))
   352       $db->_die();
   353       $db->_die();
   353   }
   354   }
   354 }
   355 }
   355 
   356 
   356 function u_1_0_populate_userpage_comments()
   357 function u_1_0_1_update_del_votes()
   357 {
   358 {
   358   //
       
   359   // UNFINISHED...
       
   360   //
       
   361   
       
   362   /*
       
   363   global $db;
   359   global $db;
   364   $q = $db->sql_query('SELECT COUNT(c.comment_id) AS num_comments...');
   360   $q = $db->sql_query('SELECT urlname, namespace, delvote_ips FROM '.table_prefix.'pages;');
   365   if ( !$q )
   361   if ( !$q )
   366     $db->_die();
   362     $db->_die();
   367   
   363   
   368   while ( $row = $db->fetchrow() )
   364   while ( $row = $db->fetchrow($q) )
   369   {
   365   {
   370     
   366     $ips = strval($row['delvote_ips']);
   371   }
   367     if ( is_array( @unserialize($ips) ) )
   372   */
   368       continue;
       
   369     $ips = explode('|', $ips);
       
   370     $new = array(
       
   371       'ip' => array(),
       
   372       'u' => array()
       
   373       );
       
   374     $i = 0;
       
   375     $prev = '';
       
   376     $prev_is_ip = false;
       
   377     foreach ( $ips as $ip )
       
   378     {
       
   379       $i++;
       
   380       $current_is_ip = is_valid_ip($ip);
       
   381       if ( $current_is_ip && $prev_is_ip )
       
   382       {
       
   383         $new['u'][] = $prev;
       
   384       }
       
   385       if ( $current_is_ip )
       
   386       {
       
   387         $new['ip'][] = $ip;
       
   388       }
       
   389       else
       
   390       {
       
   391         $new['u'][] = $ip;
       
   392       }
       
   393       $prev = $ip;
       
   394       $prev_is_ip = $current_is_ip;
       
   395     }
       
   396     $new = serialize($new);
       
   397     $e = $db->sql_query('UPDATE '.table_prefix.'pages SET delvote_ips=\'' . $db->escape($new) . '\' WHERE urlname=\'' . $db->escape($row['urlname']) . '\' AND namespace=\'' . $db->escape($row['namespace']) . '\';');
       
   398     if ( !$e )
       
   399       $db->_die();
       
   400   }
       
   401   $db->free_result($q);
   373 }
   402 }
   374 
   403 
   375 function u_1_0_RC3_make_users_extra()
   404 function u_1_0_RC3_make_users_extra()
   376 {
   405 {
   377   global $db;
   406   global $db;