当前位置: 首页>>代码示例>>PHP>>正文


PHP maj_version函数代码示例

本文整理汇总了PHP中maj_version函数的典型用法代码示例。如果您正苦于以下问题:PHP maj_version函数的具体用法?PHP maj_version怎么用?PHP maj_version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了maj_version函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: maj_v016_dist

function maj_v016_dist($version_installee, $version_cible)
{
    if (upgrade_vers(1.6, $version_installee, $version_cible)) {
        #8/08/07  plus d'indexation dans le core
        #		include_spip('inc/indexation');
        #		purger_index();
        #		creer_liste_indexation();
        maj_version(1.6);
    }
    if (upgrade_vers(1.601, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_forum ADD INDEX id_syndic (id_syndic)");
        maj_version(1.601);
    }
    if (upgrade_vers(1.603, $version_installee, $version_cible)) {
        // supprimer les fichiers deplaces
        spip_unlink('inc_meta_cache.php');
        spip_unlink('inc_meta_cache.php3');
        spip_unlink('data/engines-list.ini');
        maj_version(1.603);
    }
    if (upgrade_vers(1.604, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_auteurs ADD lang VARCHAR(10) DEFAULT '' NOT NULL");
        $u = spip_query("SELECT * FROM spip_auteurs WHERE prefs LIKE '%spip_lang%'");
        while ($row = sql_fetch($u)) {
            $prefs = unserialize($row['prefs']);
            $l = $prefs['spip_lang'];
            unset($prefs['spip_lang']);
            spip_query("UPDATE spip_auteurs SET lang=" . _q($l) . ", prefs='" . addslashes(serialize($prefs)) . "' WHERE id_auteur=" . $row['id_auteur']);
        }
        $u = spip_query("SELECT lang FROM spip_auteurs");
        maj_version(1.604, $u);
    }
}
开发者ID:nursit,项目名称:SPIP,代码行数:33,代码来源:v016.php

示例2: maj_v011_dist

function maj_v011_dist($version_installee, $version_cible)
{
    if (upgrade_vers(1.1, $version_installee, $version_cible)) {
        spip_query("DROP TABLE spip_petition");
        spip_query("DROP TABLE spip_signatures_petition");
        maj_version(1.1);
    }
}
开发者ID:genma,项目名称:spip_ynh,代码行数:8,代码来源:v011.php

示例3: maj_v012_dist

function maj_v012_dist($version_installee, $version_cible)
{
    // Correction de l'oubli des modifs creations depuis 1.04
    if (upgrade_vers(1.204, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_articles ADD accepter_forum VARCHAR(3) NOT NULL");
        spip_query("ALTER TABLE spip_forum ADD id_message bigint(21) NOT NULL");
        spip_query("ALTER TABLE spip_forum ADD INDEX id_message (id_message)");
        spip_query("ALTER TABLE spip_auteurs ADD en_ligne datetime DEFAULT '0000-00-00 00:00:00' NOT NULL");
        spip_query("ALTER TABLE spip_auteurs ADD imessage VARCHAR(3) not null");
        spip_query("ALTER TABLE spip_auteurs ADD messagerie VARCHAR(3) not null");
        maj_version(1.204);
    }
    if (upgrade_vers(1.207, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_rubriques DROP INDEX id_rubrique");
        spip_query("ALTER TABLE spip_rubriques ADD INDEX id_parent (id_parent)");
        spip_query("ALTER TABLE spip_rubriques ADD statut VARCHAR(10) NOT NULL");
        // Declencher le calcul des rubriques publiques
        include_spip('inc/rubriques');
        calculer_rubriques();
        maj_version(1.207);
    }
    if (upgrade_vers(1.208, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_auteurs_messages CHANGE forum vu CHAR(3) NOT NULL");
        spip_query("UPDATE spip_auteurs_messages SET vu='oui'");
        spip_query("UPDATE spip_auteurs_messages SET vu='non' WHERE statut='a'");
        spip_query("ALTER TABLE spip_messages ADD id_auteur bigint(21) NOT NULL");
        spip_query("ALTER TABLE spip_messages ADD INDEX id_auteur (id_auteur)");
        $result = spip_query("SELECT id_auteur, id_message FROM spip_auteurs_messages WHERE statut='de'");
        while ($row = sql_fetch($result)) {
            $id_auteur = $row['id_auteur'];
            $id_message = $row['id_message'];
            spip_query("UPDATE spip_messages SET id_auteur={$id_auteur} WHERE id_message={$id_message}");
        }
        spip_query("ALTER TABLE spip_auteurs_messages DROP statut");
        maj_version(1.208);
    }
    if (upgrade_vers(1.209, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_syndic ADD maj TIMESTAMP");
        spip_query("ALTER TABLE spip_syndic_articles ADD maj TIMESTAMP");
        spip_query("ALTER TABLE spip_messages ADD maj TIMESTAMP");
        maj_version(1.209);
    }
    if (upgrade_vers(1.21, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_messages DROP page");
        stripslashes_base('spip_articles', array('surtitre', 'titre', 'soustitre', 'descriptif', 'chapo', 'texte', 'ps'));
        stripslashes_base('spip_auteurs', array('nom', 'bio', 'nom_site'));
        stripslashes_base('spip_breves', array('titre', 'texte', 'lien_titre'));
        stripslashes_base('spip_forum', array('titre', 'texte', 'auteur', 'nom_site'));
        stripslashes_base('spip_messages', array('titre', 'texte'));
        stripslashes_base('spip_mots', array('type', 'titre', 'descriptif', 'texte'));
        stripslashes_base('spip_petitions', array('texte'));
        stripslashes_base('spip_rubriques', array('titre', 'descriptif', 'texte'));
        stripslashes_base('spip_signatures', array('nom_email', 'nom_site', 'message'));
        stripslashes_base('spip_syndic', array('nom_site', 'descriptif'));
        stripslashes_base('spip_syndic_articles', array('titre', 'lesauteurs'));
        maj_version(1.21);
    }
}
开发者ID:nursit,项目名称:SPIP,代码行数:58,代码来源:v012.php

示例4: maj_v013_dist

function maj_v013_dist($version_installee, $version_cible)
{
    if (upgrade_vers(1.3, $version_installee, $version_cible)) {
        // Modifier la syndication (pour liste de sites)
        spip_query("ALTER TABLE spip_syndic ADD syndication VARCHAR(3) NOT NULL");
        spip_query("ALTER TABLE spip_syndic ADD statut VARCHAR(10) NOT NULL");
        spip_query("ALTER TABLE spip_syndic ADD date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL");
        spip_query("UPDATE spip_syndic SET syndication='oui', statut='publie', date=NOW()");
        // Statut pour articles syndication, pour pouvoir desactiver un article
        spip_query("ALTER TABLE spip_syndic_articles ADD statut VARCHAR(10) NOT NULL");
        spip_query("UPDATE spip_syndic_articles SET statut='publie'");
        maj_version(1.3);
    }
    if (upgrade_vers(1.301, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_forum ADD id_syndic bigint(21) DEFAULT '0' NOT NULL");
        maj_version(1.301);
    }
    if (upgrade_vers(1.302, $version_installee, $version_cible)) {
        # spip_query("ALTER TABLE spip_forum_cache DROP PRIMARY KEY");
        # spip_query("ALTER TABLE spip_forum_cache DROP INDEX fichier");
        # spip_query("ALTER TABLE spip_forum_cache ADD PRIMARY KEY (fichier, id_forum, id_article, id_rubrique, id_breve, id_syndic)");
        spip_query("ALTER TABLE spip_forum ADD INDEX id_syndic (id_syndic)");
        maj_version(1.302);
    }
    if (upgrade_vers(1.303, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_rubriques ADD date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL");
        spip_query("ALTER TABLE spip_syndic ADD date_syndic datetime DEFAULT '0000-00-00 00:00:00' NOT NULL");
        spip_query("UPDATE spip_syndic SET date_syndic=date");
        maj_version(1.303);
    }
    if (upgrade_vers(1.306, $version_installee, $version_cible)) {
        spip_query("DROP TABLE spip_index_syndic_articles");
        spip_query("ALTER TABLE spip_syndic ADD date_index datetime DEFAULT '0000-00-00 00:00:00' NOT NULL");
        spip_query("ALTER TABLE spip_syndic ADD INDEX date_index (date_index)");
        maj_version(1.306);
    }
    if (upgrade_vers(1.307, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_syndic_articles ADD descriptif blob NOT NULL");
        maj_version(1.307);
    }
}
开发者ID:nursit,项目名称:SPIP,代码行数:41,代码来源:v013.php

示例5: maj_v010_dist

/**
 * Mises à jour de SPIP n°010
 *
 * @param float $version_installee Version actuelle
 * @param float $version_cible Version de destination
 **/
function maj_v010_dist($version_installee, $version_cible)
{
    if (upgrade_vers(1.01, $version_installee, $version_cible)) {
        spip_query("UPDATE spip_forum SET statut='publie' WHERE statut=''");
        maj_version(1.01);
    }
    if (upgrade_vers(1.02, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_forum ADD id_auteur BIGINT DEFAULT '0' NOT NULL");
        maj_version(1.02);
    }
    if (upgrade_vers(1.03, $version_installee, $version_cible)) {
        spip_query("DROP TABLE spip_maj");
        maj_version(1.03);
    }
    if (upgrade_vers(1.04, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_articles ADD accepter_forum VARCHAR(3)");
        maj_version(1.04);
    }
    if (upgrade_vers(1.05, $version_installee, $version_cible)) {
        spip_query("DROP TABLE spip_petition");
        spip_query("DROP TABLE spip_signatures_petition");
        maj_version(1.05);
    }
}
开发者ID:xablen,项目名称:Semaine14_SPIP_test,代码行数:30,代码来源:v010.php

示例6: maj_v018_dist

/**
 * Mises à jour de SPIP n°018
 *
 * @param float $version_installee Version actuelle
 * @param float $version_cible Version de destination
 **/
function maj_v018_dist($version_installee, $version_cible)
{
    if (upgrade_vers(1.801, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_rubriques\tADD statut_tmp VARCHAR(10) NOT NULL,\tADD date_tmp datetime DEFAULT '0000-00-00 00:00:00' NOT NULL");
        include_spip('inc/rubriques');
        calculer_rubriques();
        maj_version(1.801);
    }
    // Nouvelles tables d'invalidation
    if (upgrade_vers(1.802, $version_installee, $version_cible)) {
        spip_query("DROP TABLE spip_id_article_caches");
        spip_query("DROP TABLE spip_id_auteur_caches");
        spip_query("DROP TABLE spip_id_breve_caches");
        spip_query("DROP TABLE spip_id_document_caches");
        spip_query("DROP TABLE spip_id_forum_caches");
        spip_query("DROP TABLE spip_id_groupe_caches");
        spip_query("DROP TABLE spip_id_message_caches");
        spip_query("DROP TABLE spip_id_mot_caches");
        spip_query("DROP TABLE spip_id_rubrique_caches");
        spip_query("DROP TABLE spip_id_signature_caches");
        spip_query("DROP TABLE spip_id_syndic_article_caches");
        spip_query("DROP TABLE spip_id_syndic_caches");
        spip_query("DROP TABLE spip_id_type_caches");
        spip_query("DROP TABLE spip_inclure_caches");
        maj_version(1.802);
    }
    if (upgrade_vers(1.803, $version_installee, $version_cible)) {
        #	27 AOUT 2004 : conservons cette table pour autoriser les retours
        #	de SPIP 1.8a6 CVS vers 1.7.2
        #	spip_query("DROP TABLE spip_forum_cache");
        spip_query("DROP TABLE spip_inclure_caches");
        maj_version(1.803);
    }
    if (upgrade_vers(1.804, $version_installee, $version_cible)) {
        // recreer la table spip_caches
        spip_query("DROP TABLE spip_caches");
        creer_base();
        maj_version(1.804);
    }
    /**
     * Recalculer tous les threads
     *
     * Fonction du plugin forum recopiee ici pour assurer la montee
     * de version dans tous les cas de figure
     **/
    function maj_v018_calculer_threads()
    {
        // fixer les id_thread des debuts de discussion
        sql_update('spip_forum', array('id_thread' => 'id_forum'), "id_parent=0");
        // reparer les messages qui n'ont pas l'id_secteur de leur parent
        do {
            $discussion = "0";
            $precedent = 0;
            $r = sql_select("fille.id_forum AS id,\tmaman.id_thread AS thread", 'spip_forum AS fille, spip_forum AS maman', "fille.id_parent = maman.id_forum AND fille.id_thread <> maman.id_thread", '', "thread");
            while ($row = sql_fetch($r)) {
                if ($row['thread'] == $precedent) {
                    $discussion .= "," . $row['id'];
                } else {
                    if ($precedent) {
                        sql_updateq("spip_forum", array("id_thread" => $precedent), "id_forum IN ({$discussion})");
                    }
                    $precedent = $row['thread'];
                    $discussion = $row['id'];
                }
            }
            sql_updateq("spip_forum", array("id_thread" => $precedent), "id_forum IN ({$discussion})");
        } while ($discussion != "0");
    }
    if (upgrade_vers(1.805, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_forum ADD id_thread bigint(21) DEFAULT '0' NOT NULL");
        maj_v018_calculer_threads();
        maj_version(1.805);
    }
    // tables d'orthographe
    #if ($version_installee < 1.806)
    #	maj_version(1.806);
    // URLs propres (inc_version = 0.12)
    if (upgrade_vers(1.807, $version_installee, $version_cible)) {
        foreach (array('articles', 'breves', 'rubriques', 'mots') as $objets) {
            spip_query("ALTER TABLE spip_{$objets} ADD url_propre VARCHAR(255) NOT NULL");
            spip_query("ALTER TABLE spip_{$objets} ADD INDEX url_propre (url_propre)");
        }
        maj_version(1.807);
    }
    // referers de la veille
    if (upgrade_vers(1.808, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_referers ADD visites_veille INT UNSIGNED NOT NULL");
        maj_version(1.808);
    }
    // corrections diverses
    if (upgrade_vers(1.809, $version_installee, $version_cible)) {
        // plus de retour possible vers 1.7.2
        spip_query("DROP TABLE spip_forum_cache");
        // les requetes ci-dessous ne s'appliqueront que si on est passe
//.........这里部分代码省略.........
开发者ID:xablen,项目名称:Semaine14_SPIP_test,代码行数:101,代码来源:v018.php

示例7: v019_pre193

function v019_pre193($version_installee, $version_cible)
{
    // Syndication : ajout de l'option resume=oui/non et de la langue
    if (upgrade_vers(1.901, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_syndic ADD `resume` VARCHAR(3) DEFAULT 'oui'");
        spip_query("ALTER TABLE spip_syndic_articles ADD `lang` VARCHAR(10) DEFAULT '' NOT NULL");
        maj_version(1.901);
    }
    // Syndication : ajout de source, url_source, tags
    if (upgrade_vers(1.902, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_syndic_articles ADD `url_source` TINYTEXT DEFAULT '' NOT NULL");
        spip_query("ALTER TABLE spip_syndic_articles ADD `source` TINYTEXT DEFAULT '' NOT NULL");
        spip_query("ALTER TABLE spip_syndic_articles ADD `tags` TEXT DEFAULT '' NOT NULL");
        maj_version(1.902);
    }
    // URLs propres des sites (sait-on jamais)
    // + oubli des KEY url_propre sur les auteurs si installation neuve
    if (upgrade_vers(1.903, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_syndic ADD `url_propre` VARCHAR(255) NOT NULL");
        spip_query("ALTER TABLE spip_syndic ADD INDEX `url_propre` (`url_propre`)");
        spip_query("ALTER TABLE spip_auteurs ADD INDEX `url_propre` (`url_propre`)");
        maj_version(1.903);
    }
    // suppression des anciennes tables temporaires des visites
    // (maintenant stockees sous forme de fichiers)
    if (upgrade_vers(1.904, $version_installee, $version_cible)) {
        spip_query("DROP TABLE IF EXISTS spip_visites_temp");
        spip_query("DROP TABLE IF EXISTS spip_referers_temp");
        maj_version(1.904);
    }
    // fusion des 10 tables index en une seule
    // pour fonctions futures evoluees du moteur de recherche
    if (upgrade_vers(1.905, $version_installee, $version_cible)) {
        // agrandir le champ "valeur" de spip_meta pour pouvoir y stocker
        // des choses plus sympa
        spip_query("ALTER TABLE spip_meta DROP INDEX `valeur`");
        spip_query("ALTER TABLE spip_meta CHANGE `valeur` `valeur` TEXT");
        // table des correspondances table->id_table
        $liste_tables = array();
        $liste_tables[1] = 'spip_articles';
        $liste_tables[2] = 'spip_auteurs';
        $liste_tables[3] = 'spip_breves';
        $liste_tables[4] = 'spip_documents';
        $liste_tables[5] = 'spip_forum';
        $liste_tables[6] = 'spip_mots';
        $liste_tables[7] = 'spip_rubriques';
        $liste_tables[8] = 'spip_signatures';
        $liste_tables[9] = 'spip_syndic';
        ecrire_meta('index_table', serialize($liste_tables));
        ## devenu inutile car suppression totale de l'indexation
        /*
        		spip_query("INSERT INTO spip_index (`hash`,`points`,`id_objet`,`id_table`) SELECT `hash`,`points`,`id_article` as id_objet,'1' as id_table FROM spip_index_articles");
        		spip_query("DROP TABLE IF EXISTS spip_index_articles");
        
        		spip_query("INSERT INTO spip_index (`hash`,`points`,`id_objet`,`id_table`) SELECT `hash`,`points`,`id_auteur` as id_objet,'2' as id_table FROM spip_index_auteurs");
        		spip_query("DROP TABLE IF EXISTS spip_index_auteurs");
        
        		spip_query("INSERT INTO spip_index (`hash`,`points`,`id_objet`,`id_table`) SELECT `hash`,`points`,`id_breve` as id_objet,'3' as id_table FROM spip_index_breves");
        		spip_query("DROP TABLE IF EXISTS spip_index_breves");
        
        		spip_query("INSERT INTO spip_index (`hash`,`points`,`id_objet`,`id_table`) SELECT `hash`,`points`,`id_document` as id_objet,'4' as id_table FROM spip_index_documents");
        		spip_query("DROP TABLE IF EXISTS spip_index_documents");
        
        		spip_query("INSERT INTO spip_index (`hash`,`points`,`id_objet`,`id_table`) SELECT `hash`,`points`,`id_forum` as id_objet,'5' as id_table FROM spip_index_forum");
        		spip_query("DROP TABLE IF EXISTS spip_index_forum");
        
        		spip_query("INSERT INTO spip_index (`hash`,`points`,`id_objet`,`id_table`) SELECT `hash`,`points`,`id_mot` as id_objet,'6' as id_table FROM spip_index_mots");
        		spip_query("DROP TABLE IF EXISTS spip_index_mots");
        
        		spip_query("INSERT INTO spip_index (`hash`,`points`,`id_objet`,`id_table`) SELECT `hash`,`points`,`id_rubrique` as id_objet,'7' as id_table FROM spip_index_rubriques");
        		spip_query("DROP TABLE IF EXISTS spip_index_rubriques");
        
        		spip_query("INSERT INTO spip_index (`hash`,`points`,`id_objet`,`id_table`) SELECT `hash`,`points`,`id_signature` as id_objet,'8' as id_table FROM spip_index_signatures");
        		spip_query("DROP TABLE IF EXISTS spip_index_signatures");
        
        		spip_query("INSERT INTO spip_index (`hash`,`points`,`id_objet`,`id_table`) SELECT `hash`,`points`,`id_syndic` as id_objet,'9' as `id_table FROM spip_index_syndic");
        		spip_query("DROP TABLE IF EXISTS spip_index_syndic");
        */
        maj_version(1.905);
    }
    // cette table est desormais geree par le plugin "podcast_client", on la
    // supprime si le plugin n'est pas active ; risque inherent a l'utilisation
    // de versions alpha :-)
    if (upgrade_vers(1.906, $version_installee, $version_cible)) {
        if (!@in_array('podcast_client', $GLOBALS['plugins'])) {
            spip_query("DROP TABLE spip_documents_syndic");
        }
        maj_version(1.906);
    }
    if (upgrade_vers(1.907, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_forum ADD INDEX `idx` (`idx`)");
        maj_version(1.907);
    }
    // Oups ! on stockait les tags de syndication sous la forme rel="category"
    // au lieu de rel="directory" - http://microformats.org/wiki/rel-directory
    if (upgrade_vers(1.908, $version_installee, $version_cible)) {
        spip_query("UPDATE spip_syndic_articles SET `tags` = REPLACE(`tags`, 'rel=\"category\">', 'rel=\"directory\">') WHERE `tags` like '%category%'");
        maj_version(1.908);
    }
    if (upgrade_vers(1.909, $version_installee, $version_cible)) {
//.........这里部分代码省略.........
开发者ID:nursit,项目名称:SPIP,代码行数:101,代码来源:v019_pre193.php

示例8: maj_v017_dist

/**
 * Mises à jour de SPIP n°017
 * 
 * @param float $version_installee Version actuelle
 * @param float $version_cible     Version de destination
**/
function maj_v017_dist($version_installee, $version_cible)
{
    if (upgrade_vers(1.702, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_articles ADD extra longblob NULL");
        spip_query("ALTER TABLE spip_auteurs ADD extra longblob NULL");
        spip_query("ALTER TABLE spip_breves ADD extra longblob NULL");
        spip_query("ALTER TABLE spip_rubriques ADD extra longblob NULL");
        spip_query("ALTER TABLE spip_mots ADD extra longblob NULL");
        // recuperer les eventuels 'supplement' installes en 1.701
        if ($version_installee == 1.701) {
            spip_query("UPDATE spip_articles SET extra = supplement");
            spip_query("ALTER TABLE spip_articles DROP supplement");
            spip_query("UPDATE spip_auteurs SET extra = supplement");
            spip_query("ALTER TABLE spip_auteurs DROP supplement");
            spip_query("UPDATE spip_breves SET extra = supplement");
            spip_query("ALTER TABLE spip_breves DROP supplement");
            spip_query("UPDATE spip_rubriques SET extra = supplement");
            spip_query("ALTER TABLE spip_rubriques DROP supplement");
            spip_query("UPDATE spip_mots SET extra = supplement");
            spip_query("ALTER TABLE spip_mots DROP supplement");
        }
        $u = spip_query("SELECT extra FROM spip_articles");
        $u &= spip_query("SELECT extra FROM spip_auteurs");
        $u &= spip_query("SELECT extra FROM spip_breves");
        $u &= spip_query("SELECT extra FROM spip_rubriques");
        $u &= spip_query("SELECT extra FROM spip_mots");
        maj_version(1.702, $u);
    }
    if (upgrade_vers(1.703, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_articles ADD lang VARCHAR(10) DEFAULT '' NOT NULL");
        spip_query("ALTER TABLE spip_rubriques ADD lang VARCHAR(10) DEFAULT '' NOT NULL");
        maj_version(1.703);
    }
    if (upgrade_vers(1.704, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_articles ADD INDEX lang (lang)");
        spip_query("ALTER TABLE spip_auteurs ADD INDEX lang (lang)");
        spip_query("ALTER TABLE spip_rubriques ADD INDEX lang (lang)");
        maj_version(1.704);
    }
    if (upgrade_vers(1.705, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_articles ADD langue_choisie VARCHAR(3) DEFAULT 'non'");
        spip_query("ALTER TABLE spip_rubriques ADD langue_choisie VARCHAR(3) DEFAULT 'non'");
        maj_version(1.705);
    }
    if (upgrade_vers(1.707, $version_installee, $version_cible)) {
        spip_query("UPDATE spip_articles SET langue_choisie='oui' WHERE MID(lang,1,1) != '.' AND lang != ''");
        spip_query("UPDATE spip_articles SET lang=MID(lang,2,8) WHERE langue_choisie = 'non'");
        spip_query("UPDATE spip_rubriques SET langue_choisie='oui' WHERE MID(lang,1,1) != '.' AND lang != ''");
        spip_query("UPDATE spip_rubriques SET lang=MID(lang,2,8) WHERE langue_choisie = 'non'");
        maj_version(1.707);
    }
    if (upgrade_vers(1.708, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_breves ADD lang VARCHAR(10) DEFAULT '' NOT NULL");
        spip_query("ALTER TABLE spip_breves ADD langue_choisie VARCHAR(3) DEFAULT 'non'");
        maj_version(1.708);
    }
    if (upgrade_vers(1.709, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_articles ADD id_trad bigint(21) DEFAULT '0' NOT NULL");
        spip_query("ALTER TABLE spip_articles ADD INDEX id_trad (id_trad)");
        maj_version(1.709);
    }
    if (upgrade_vers(1.717, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_articles ADD INDEX date_modif (date_modif)");
        maj_version(1.717);
    }
    if (upgrade_vers(1.718, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_referers DROP domaine");
        spip_query("ALTER TABLE spip_referers_articles DROP domaine");
        spip_query("ALTER TABLE spip_referers_temp DROP domaine");
        maj_version(1.718);
    }
    if (upgrade_vers(1.722, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_articles ADD nom_site tinytext NOT NULL");
        spip_query("ALTER TABLE spip_articles ADD url_site VARCHAR(255) NOT NULL");
        spip_query("ALTER TABLE spip_articles ADD INDEX url_site (url_site)");
        if ($version_installee >= 1.72) {
            spip_query("UPDATE spip_articles SET url_site=url_ref");
            spip_query("ALTER TABLE spip_articles DROP INDEX url_ref");
            spip_query("ALTER TABLE spip_articles DROP url_ref");
        }
        maj_version(1.722);
    }
    if (upgrade_vers(1.723, $version_installee, $version_cible)) {
        if ($version_installee == 1.722) {
            spip_query("ALTER TABLE spip_articles MODIFY url_site VARCHAR(255) NOT NULL");
            spip_query("ALTER TABLE spip_articles DROP INDEX url_site;");
            spip_query("ALTER TABLE spip_articles ADD INDEX url_site (url_site);");
        }
        maj_version(1.723);
    }
    if (upgrade_vers(1.724, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_messages ADD date_fin datetime DEFAULT '0000-00-00 00:00:00' NOT NULL");
        maj_version(1.724);
    }
//.........这里部分代码省略.........
开发者ID:JLuc,项目名称:SPIP,代码行数:101,代码来源:v017.php

示例9: maj_v014_dist

function maj_v014_dist($version_installee, $version_cible)
{
    if (upgrade_vers(1.404, $version_installee, $version_cible)) {
        spip_query("UPDATE spip_mots SET type='Mots sans groupe...' WHERE type=''");
        $result = spip_query("SELECT * FROM spip_mots GROUP BY type");
        while ($row = sql_fetch($result)) {
            $type = addslashes($row['type']);
            // Old style, doit echouer
            spip_log('ne pas tenir compte de l erreur spip_groupes_mots ci-dessous:', 'mysql');
            spip_query("INSERT INTO spip_groupes_mots \t\t\t\t\t(titre, unseul, obligatoire, articles, breves, rubriques, syndic, 0minirezo, 1comite, 6forum)\t\t\t\t\tVALUES (\"{$type}\", 'non', 'non', 'oui', 'oui', 'non', 'oui', 'oui', 'oui', 'non')");
            // New style, devrait marcher
            spip_query("INSERT INTO spip_groupes_mots \t\t\t\t\t(titre, unseul, obligatoire, articles, breves, rubriques, syndic, minirezo, comite, forum)\t\t\t\t\tVALUES (\"{$type}\", 'non', 'non', 'oui', 'oui', 'non', 'oui', 'oui', 'oui', 'non')");
        }
        sql_delete("spip_mots", "titre='kawax'");
        maj_version(1.404);
    }
    if (upgrade_vers(1.405, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_mots ADD id_groupe bigint(21) NOT NULL");
        $result = spip_query("SELECT * FROM spip_groupes_mots");
        while ($row = sql_fetch($result)) {
            $id_groupe = addslashes($row['id_groupe']);
            $type = addslashes($row['titre']);
            spip_query("UPDATE spip_mots SET id_groupe = '{$id_groupe}' WHERE type='{$type}'");
        }
        maj_version(1.405);
    }
    if (upgrade_vers(1.408, $version_installee, $version_cible)) {
        // Images articles passent dans spip_documents
        $result = spip_query("SELECT id_article, images FROM spip_articles WHERE LENGTH(images) > 0");
        $types = array('jpg' => 1, 'png' => 2, 'gif' => 3);
        while ($row = @sql_fetch($result)) {
            $id_article = $row['id_article'];
            $images = $row['images'];
            $images = explode(",", $images);
            reset($images);
            $replace = '_orig_';
            foreach ($images as $val) {
                $image = explode("|", $val);
                $fichier = $image[0];
                $largeur = $image[1];
                $hauteur = $image[2];
                preg_match(",-([0-9]+)\\.(gif|jpg|png)\$,i", $fichier, $match);
                $id_type = intval($types[$match[2]]);
                $num_img = $match[1];
                $fichier = _DIR_IMG . $fichier;
                $taille = @filesize($fichier);
                // ici on n'a pas les fonctions absctract !
                $s = spip_query("INSERT INTO spip_documents (titre, id_type, fichier, mode, largeur, hauteur, taille) VALUES ('image {$largeur} x {$hauteur}', {$id_type}, '{$fichier}', 'vignette', '{$largeur}', '{$hauteur}', '{$taille}')");
                $id_document = mysql_insert_id($s);
                if ($id_document > 0) {
                    spip_query("INSERT INTO spip_documents_articles (id_document, id_article) VALUES ({$id_document}, {$id_article})");
                    $replace = "REPLACE({$replace}, '<IMG{$num_img}|', '<IM_{$id_document}|')";
                } else {
                    echo _T('texte_erreur_mise_niveau_base', array('fichier' => $fichier, 'id_article' => $id_article));
                    exit;
                }
            }
            $replace = "REPLACE({$replace}, '<IM_', '<IMG')";
            $replace_chapo = str_replace('_orig_', 'chapo', $replace);
            $replace_descriptif = str_replace('_orig_', 'descriptif', $replace);
            $replace_texte = str_replace('_orig_', 'texte', $replace);
            $replace_ps = str_replace('_orig_', 'ps', $replace);
            spip_query("UPDATE spip_articles SET chapo={$replace_chapo}, descriptif={$replace_descriptif}, texte={$replace_texte}, ps={$replace_ps} WHERE id_article={$id_article}");
        }
        spip_query("ALTER TABLE spip_articles DROP images");
        maj_version(1.408);
    }
    if (upgrade_vers(1.414, $version_installee, $version_cible)) {
        // Forum par defaut "en dur" dans les spip_articles
        // -> non, prio (priori), pos (posteriori), abo (abonnement)
        $accepter_forum = substr($GLOBALS['meta']["forums_publics"], 0, 3);
        $result = spip_query("ALTER TABLE spip_articles CHANGE accepter_forum accepter_forum CHAR(3) NOT NULL");
        $result = spip_query("UPDATE spip_articles SET accepter_forum='{$accepter_forum}' WHERE accepter_forum != 'non'");
        maj_version(1.414);
    }
    /*
    if ($version_installee == 1.415) {
    	spip_query("ALTER TABLE spip_documents DROP inclus");
    	maj_version (1.415);
    }
    */
    if (upgrade_vers(1.417, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_syndic_articles DROP date_index");
        maj_version(1.417);
    }
    if (upgrade_vers(1.418, $version_installee, $version_cible)) {
        $result = spip_query("SELECT * FROM spip_auteurs WHERE statut = '0minirezo' AND email != '' ORDER BY id_auteur LIMIT 1");
        if ($webmaster = sql_fetch($result)) {
            ecrire_meta('email_webmaster', $webmaster['email']);
        }
        maj_version(1.418);
    }
    if (upgrade_vers(1.419, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_auteurs ADD alea_actuel TINYTEXT DEFAULT ''");
        spip_query("ALTER TABLE spip_auteurs ADD alea_futur TINYTEXT DEFAULT ''");
        spip_query("UPDATE spip_auteurs SET alea_futur = FLOOR(32000*RAND())");
        maj_version(1.419);
    }
    if (upgrade_vers(1.42, $version_installee, $version_cible)) {
        spip_query("UPDATE spip_auteurs SET alea_actuel='' WHERE statut='nouveau'");
//.........这里部分代码省略.........
开发者ID:nursit,项目名称:SPIP,代码行数:101,代码来源:v014.php

示例10: maj_v009_dist

function maj_v009_dist($version_installee, $version_cible)
{
    if (upgrade_vers(0.98, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_articles ADD maj TIMESTAMP");
        spip_query("ALTER TABLE spip_articles ADD export VARCHAR(10) DEFAULT 'oui'");
        spip_query("ALTER TABLE spip_articles ADD images TEXT DEFAULT ''");
        spip_query("ALTER TABLE spip_articles ADD date_redac datetime DEFAULT '0000-00-00 00:00:00' NOT NULL");
        spip_query("ALTER TABLE spip_articles DROP INDEX id_article");
        spip_query("ALTER TABLE spip_articles ADD INDEX id_rubrique (id_rubrique)");
        spip_query("ALTER TABLE spip_articles ADD visites INTEGER DEFAULT '0' NOT NULL");
        spip_query("ALTER TABLE spip_articles ADD referers BLOB NOT NULL");
        spip_query("ALTER TABLE spip_auteurs ADD maj TIMESTAMP");
        spip_query("ALTER TABLE spip_auteurs ADD pgp BLOB NOT NULL");
        spip_query("ALTER TABLE spip_auteurs_articles ADD INDEX id_auteur (id_auteur), ADD INDEX id_article (id_article)");
        spip_query("ALTER TABLE spip_rubriques ADD maj TIMESTAMP");
        spip_query("ALTER TABLE spip_rubriques ADD export VARCHAR(10) DEFAULT 'oui', ADD id_import BIGINT DEFAULT '0'");
        spip_query("ALTER TABLE spip_breves ADD maj TIMESTAMP");
        spip_query("ALTER TABLE spip_breves DROP INDEX id_breve");
        spip_query("ALTER TABLE spip_breves DROP INDEX id_breve_2");
        spip_query("ALTER TABLE spip_breves ADD INDEX id_rubrique (id_rubrique)");
        spip_query("ALTER TABLE spip_forum ADD ip VARCHAR(16)");
        spip_query("ALTER TABLE spip_forum ADD maj TIMESTAMP");
        spip_query("ALTER TABLE spip_forum DROP INDEX id_forum");
        spip_query("ALTER TABLE spip_forum ADD INDEX id_parent (id_parent), ADD INDEX id_rubrique (id_rubrique), ADD INDEX id_article(id_article), ADD INDEX id_breve(id_breve)");
        maj_version(0.98);
    }
    if (upgrade_vers(0.99, $version_installee, $version_cible)) {
        $result = spip_query("SELECT DISTINCT id_article FROM spip_forum WHERE id_article!=0 AND id_parent=0");
        while ($row = sql_fetch($result)) {
            unset($forums_article);
            $id_article = $row['id_article'];
            $result2 = spip_query("SELECT id_forum FROM spip_forum WHERE id_article={$id_article}");
            for (;;) {
                unset($forums);
                while ($row2 = sql_fetch($result2)) {
                    $forums[] = $row2['id_forum'];
                }
                if (!$forums) {
                    break;
                }
                $forums = join(',', $forums);
                $forums_article[] = $forums;
                $result2 = spip_query("SELECT id_forum FROM spip_forum WHERE id_parent IN ({$forums})");
            }
            $forums_article = join(',', $forums_article);
            spip_query("UPDATE spip_forum SET id_article={$id_article} WHERE id_forum IN ({$forums_article})");
        }
        $result = spip_query("SELECT DISTINCT id_breve FROM spip_forum WHERE id_breve!=0 AND id_parent=0");
        while ($row = sql_fetch($result)) {
            unset($forums_breve);
            $id_breve = $row['id_breve'];
            $result2 = spip_query("SELECT id_forum FROM spip_forum WHERE id_breve={$id_breve}");
            for (;;) {
                unset($forums);
                while ($row2 = sql_fetch($result2)) {
                    $forums[] = $row2['id_forum'];
                }
                if (!$forums) {
                    break;
                }
                $forums = join(',', $forums);
                $forums_breve[] = $forums;
                $result2 = spip_query("SELECT id_forum FROM spip_forum WHERE id_parent IN ({$forums})");
            }
            $forums_breve = join(',', $forums_breve);
            spip_query("UPDATE spip_forum SET id_breve={$id_breve} WHERE id_forum IN ({$forums_breve})");
        }
        $result = spip_query("SELECT DISTINCT id_rubrique FROM spip_forum WHERE id_rubrique!=0 AND id_parent=0");
        while ($row = sql_fetch($result)) {
            unset($forums_rubrique);
            $id_rubrique = $row['id_rubrique'];
            $result2 = spip_query("SELECT id_forum FROM spip_forum WHERE id_rubrique={$id_rubrique}");
            for (;;) {
                unset($forums);
                while ($row2 = sql_fetch($result2)) {
                    $forums[] = $row2['id_forum'];
                }
                if (!$forums) {
                    break;
                }
                $forums = join(',', $forums);
                $forums_rubrique[] = $forums;
                $result2 = spip_query("SELECT id_forum FROM spip_forum WHERE id_parent IN ({$forums})");
            }
            $forums_rubrique = join(',', $forums_rubrique);
            spip_query("UPDATE spip_forum SET id_rubrique={$id_rubrique} WHERE id_forum IN ({$forums_rubrique})");
        }
        maj_version(0.99);
    }
    if (upgrade_vers(0.997, $version_installee, $version_cible)) {
        spip_query("DROP TABLE spip_index");
        maj_version(0.997);
    }
    if (upgrade_vers(0.999, $version_installee, $version_cible)) {
        spip_query("ALTER TABLE spip_auteurs CHANGE pass pass tinyblob NOT NULL");
        spip_query("ALTER TABLE spip_auteurs ADD htpass tinyblob NOT NULL");
        $result = spip_query("SELECT id_auteur, pass FROM spip_auteurs WHERE pass!=''");
        while ($r = sql_fetch($result)) {
            $htpass = generer_htpass($r['pass']);
            $pass = md5($pass);
//.........这里部分代码省略.........
开发者ID:nursit,项目名称:SPIP,代码行数:101,代码来源:v009.php


注:本文中的maj_version函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。