Dotclear

Changeset 2840:8777e1372db4


Ignore:
Timestamp:
12/14/14 10:20:18 (11 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
2.7
Message:

Copy nb_post_per_page to nb_post_for_home during Dotclear upgrade, should fixes #2013

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/dbschema/upgrade.php

    r2566 r2840  
    406406               } 
    407407 
     408               if (version_compare($version,'2.7','<=')) 
     409               { 
     410                    # Some new settings should be initialized, prepare db queries 
     411                    $strReqFormat = 'INSERT INTO '.$core->prefix.'setting'; 
     412                    $strReqFormat .= ' (setting_id,setting_ns,setting_value,setting_type,setting_label)'; 
     413                    $strReqFormat .= ' VALUES(\'%s\',\'system\',\'%s\',\'string\',\'%s\')'; 
     414 
     415                    $strReqCount = 'SELECT count(1) FROM '.$core->prefix.'setting'; 
     416                    $strReqCount .= ' WHERE setting_id = \'%s\''; 
     417                    $strReqCount .= ' AND setting_ns = \'system\''; 
     418                    $strReqCount .= ' AND blog_id IS NULL'; 
     419 
     420                    $strReqSelect = 'SELECT setting_value FROM '.$core->prefix.'setting'; 
     421                    $strReqSelect .= ' WHERE setting_id = \'%s\''; 
     422                    $strReqSelect .= ' AND setting_ns = \'system\''; 
     423                    $strReqSelect .= ' AND blog_id IS NULL'; 
     424 
     425                    # Add nb of posts for home (first page), copying nb of posts on every page 
     426                    $rs = $core->con->select(sprintf($strReqCount,'nb_post_for_home')); 
     427                    if ($rs->f(0)==0) { 
     428                         $rs = $core->con->select(sprintf($strReqSelect,'nb_post_per_page')); 
     429                         $strReq = sprintf($strReqFormat,'nb_post_for_home',$rs->f(0),'Nb of posts on home (first page only)'); 
     430                         $core->con->execute($strReq); 
     431                    } 
     432               } 
     433 
    408434               $core->setVersion('core',DC_VERSION); 
    409435               $core->blogDefaults(); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map