Log in with username/password: lyceum/lyceum

Changeset 119

Show
Ignore:
Timestamp:
10/27/05 22:10:18 (3 years ago)
Author:
john
Message:

merging wordpress changes

note the changes in source:trunk/src/lyceum/wp-admin/upgrade-functions.php#119 for clues on what upgrade functions will be totally redundant for lyceum.

also note changes in source:trunk/src/lyceum/wp-admin/upgrade-schema.php#119 and source:trunk/src/lyceum/wp-admin/install.php#119, some of these might need to be taken out in order to be happy with lyceum's usage of function populate_roles()

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • tags/0.6RC/dev/wordpress_patch_history.txt

    r88 r119  
    26262962                 complete merge 
    27272963                 complete merge 
     282964                 complete merge 
  • trunk/dev/wordpress_patch_history.txt

    r88 r119  
    26262962                 complete merge 
    27272963                 complete merge 
     282965                 complete merge 
     292966                 complete merge 
     302967                 complete merge 
     312968                 complete merge 
  • trunk/src/lyceum/wp-admin/admin-functions.php

    r70 r119  
    15211521 
    15221522   $path = ABSPATH . $dir; 
     1523    
     1524   // Give the new dirs the same perms as wp-content. 
     1525   $stat = stat(ABSPATH . 'wp-content'); 
     1526   $dir_perms = $stat['mode'] & 0000777;  // Get the permission bits. 
    15231527 
    15241528        // Make sure we have an uploads dir 
     
    15261530                if ( ! mkdir( $path ) ) 
    15271531                        return array('error' => "Unable to create directory $path. Is its parent directory writable by the server?"); 
    1528       @ chmod( ABSPATH . $path, 0774 ); 
     1532      @ chmod( $path, $dir_perms ); 
    15291533   } 
    15301534 
     
    15401544                if ( ! mkdir( $pathy ) ) 
    15411545                        return array('error' => "Unable to create directory $pathy. Is $path writable?"); 
    1542       @ chmod( $pathy, 0774 ); 
     1546      @ chmod( $pathy, $dir_perms ); 
    15431547   } 
    15441548 
     
    15471551                if ( ! mkdir( $pathym ) ) 
    15481552                        return array('error' => "Unable to create directory $pathym. Is $pathy writable?"); 
    1549       @ chmod( $pathym, 0774 ); 
     1553      @ chmod( $pathym, $dir_perms ); 
    15501554   } 
    15511555 
  • trunk/src/lyceum/wp-admin/image-uploading.php

    r62 r119  
    114114if ( false === move_uploaded_file($_FILES['image']['tmp_name'], $file) ) 
    115115   die('The uploaded file could not be moved to $file.'); 
    116 chmod($file, 0775); 
     116chmod($file, 0666);  // FIXME: Need to set this according to rw bits on parent dir. 
    117117 
    118118// Compute the URL 
  • trunk/src/lyceum/wp-admin/install.php

    r98 r119  
    148148make_db_current_silent(); 
    149149//populate_options(); 
     150populate_roles(); 
    150151 
    151152// Set up admin user 
  • trunk/src/lyceum/wp-admin/upgrade-functions.php

    r2 r119  
    55// Functions to be called in install and upgrade scripts 
    66function upgrade_all() { 
     7   global $wp_current_db_version, $wp_db_version; 
     8   $wp_current_db_version = __get_option('db_version'); 
     9 
     10   // We are up-to-date.  Nothing to do. 
     11   if ( $wp_db_version == $wp_current_db_version ) 
     12      return; 
     13 
     14   // If the version is not set in the DB, try to guess the version. 
     15   if ( empty($wp_current_db_version) ) { 
     16      $wp_current_db_version = 0; 
     17 
     18      // If the template option exists, we have 1.5. 
     19      $template = __get_option('template'); 
     20      if ( !empty($template) ) 
     21         $wp_current_db_version = 2541; 
     22   } 
     23    
    724   populate_options(); 
    8    upgrade_100(); 
    9    upgrade_101(); 
    10    upgrade_110(); 
    11    upgrade_130(); 
    12    upgrade_160(); 
     25 
     26   if ( $wp_current_db_version < 2541 ) { 
     27      upgrade_100(); 
     28      upgrade_101(); 
     29      upgrade_110(); 
     30      upgrade_130(); 
     31   } 
     32    
     33   if ( $wp_current_db_version < 2966 ) 
     34      upgrade_160(); 
     35 
    1336   save_mod_rewrite_rules(); 
     37    
     38   update_option('db_version', $wp_db_version); 
    1439} 
    1540 
     
    83108 
    84109function upgrade_110() { 
    85   global $wpdb; 
     110  global $wpdb; 
    86111    
    87112    // Set user_nicename. 
    88    // FIXME: user_nickname is no longer in the user table.  Need to update and 
    89    // move this code to where the new usermeta table is setup. 
    90 //  $users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users"); 
    91 //    foreach ($users as $user) { 
    92 //       if ('' == $user->user_nicename) {  
    93 //          $newname = sanitize_title($user->user_nickname); 
    94 //          $wpdb->query("UPDATE $wpdb->users SET user_nicename = '$newname' WHERE ID = '$user->ID'"); 
    95 //       } 
    96 //    } 
     113   $users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users"); 
     114   foreach ($users as $user) { 
     115      if ('' == $user->user_nicename) {  
     116         $newname = sanitize_title($user->user_nickname); 
     117         $wpdb->query("UPDATE $wpdb->users SET user_nicename = '$newname' WHERE ID = '$user->ID'"); 
     118      } 
     119   } 
    97120 
    98121   $users = $wpdb->get_results("SELECT ID, user_pass from $wpdb->users"); 
     
    219242function upgrade_160() { 
    220243   global $wpdb, $table_prefix; 
     244    
     245   populate_roles_160(); 
     246 
    221247   $users = $wpdb->get_results("SELECT * FROM $wpdb->users"); 
    222248   foreach ( $users as $user ) : 
  • trunk/src/lyceum/wp-admin/upgrade-schema.php

    r77 r119  
    256256//jjb TODO make add_cap blog-specific? 
    257257function populate_roles() { 
     258   populate_roles_160();    
     259} 
     260 
     261function populate_roles_160() { 
    258262   global $wp_roles; 
    259263   // Add roles 
  • trunk/src/lyceum/wp-includes/classes.php

    r90 r119  
    439439      // Category stuff for nice URIs 
    440440 
     441      global $cache_categories; 
    441442      if ('' != $q['category_name']) { 
    442          if (stristr($q['category_name'],'/')) { 
    443             $q['category_name'] = explode('/',$q['category_name']); 
    444             if ($q['category_name'][count($q['category_name'])-1]) { 
    445                $q['category_name'] = $q['category_name'][count($q['category_name'])-1]; // no trailing slash 
    446             } else { 
    447                $q['category_name'] = $q['category_name'][count($q['category_name'])-2]; // there was a trailling slash 
    448             } 
    449          } 
    450          $q['category_name'] = sanitize_title($q['category_name']); 
     443         $cat_paths = '/' . trim(urldecode($q['category_name']), '/'); 
     444         $q['category_name'] = sanitize_title(basename($cat_paths)); 
     445         $cat_paths = explode('/', $cat_paths); 
     446         foreach($cat_paths as $pathdir) 
     447            $cat_path .= ($pathdir!=''?'/':'') . sanitize_title($pathdir); 
     448 
     449         $q['cat'] = array_reduce( 
     450            $cache_categories,  
     451            create_function('$a, $b', 'return ($b->fullpath == "'.$cat_path.'") ? $b->cat_ID : $a;'), 
     452            0 
     453         ); 
     454 
     455         // If full path not found, look for last dir as category ignoring parent 
     456         if($q['cat'] == 0) { 
     457            $q['cat'] = array_reduce( 
     458               $cache_categories,  
     459               create_function('$a, $b', 'return ($b->category_nicename == "'.$q['category_name'].'") ? $b->cat_ID : $a;'), 
     460               0 
     461            ); 
     462         } 
     463          
    451464         $tables = ", $wpdb->post2cat, $wpdb->categories"; 
    452465         $join = " LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) LEFT JOIN $wpdb->categories ON ($wpdb->post2cat.category_id = $wpdb->categories.cat_ID) "; 
    453           
    454              
    455          $whichcat = " AND (category_nicename = '" . $q['category_name'] . "'"; 
    456          $q['cat'] = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE blog='$blog' AND category_nicename = '" . $q['category_name'] . "'");//lyceum 
     466         $whichcat = " AND (category_id = '" . $q['cat'] . "'"; 
    457467         $whichcat .= get_category_children($q['cat'], " OR category_id = "); 
    458468         $whichcat .= ")"; 
  • trunk/src/lyceum/wp-includes/functions.php

    r98 r119  
    13221322function update_category_cache() { 
    13231323   global $cache_categories, $wpdb, $blog; 
    1324    if($dogs = $wpdb->get_results("SELECT * FROM $wpdb->categories WHERE blog = '$blog'"))://lyceum 
     1324   if ( $dogs = $wpdb->get_results("SELECT * FROM $wpdb->categories WHERE blog = '$blog'") ): 
    13251325      foreach ($dogs as $catt) 
    13261326         $cache_categories[$catt->cat_ID] = $catt; 
     1327 
     1328      foreach ($cache_categories as $catt) { 
     1329         $curcat = $catt->cat_ID; 
     1330         $cache_categories[$catt->cat_ID]->fullpath = '/' . $cache_categories[$catt->cat_ID]->category_nicename; 
     1331         while ($cache_categories[$curcat]->category_parent != 0) { 
     1332            $curcat = $cache_categories[$curcat]->category_parent; 
     1333            $cache_categories[$catt->cat_ID]->fullpath = '/' . $cache_categories[$curcat]->category_nicename . $cache_categories[$catt->cat_ID]->fullpath; 
     1334         }  
     1335      } 
    13271336      return true; 
    13281337   else :  
  • trunk/src/lyceum/wp-includes/version.php

    r90 r119  
    44 
    55$wp_version = '0.6RC'; 
     6$wp_db_version = 2966; 
    67 
    78?> 
Log in with username/password: lyceum/lyceum