[pLog-svn] r978 - plog/trunk
oscar at devel.plogworld.net
oscar at devel.plogworld.net
Sun Feb 6 20:28:21 GMT 2005
Author: oscar
Date: 2005-02-06 20:28:21 +0000 (Sun, 06 Feb 2005)
New Revision: 978
Removed:
plog/trunk/update_to_cvs.php
Log:
this file is not needed anymore
Deleted: plog/trunk/update_to_cvs.php
===================================================================
--- plog/trunk/update_to_cvs.php 2005-02-06 20:14:32 UTC (rev 977)
+++ plog/trunk/update_to_cvs.php 2005-02-06 20:28:21 UTC (rev 978)
@@ -1,51 +0,0 @@
-<?php
- if (!defined( "PLOG_CLASS_PATH" )) {
- define( "PLOG_CLASS_PATH", dirname(__FILE__)."/");
- }
-
- if (!defined( "QFRAMEWORK_CLASS_PATH" )) {
- define( "QFRAMEWORK_CLASS_PATH", dirname(__FILE__)."/");
- }
-
- include_once( "class/dao/model.class.php" );
-
- $model = new Model();
-
- $Table[1] = "CREATE TABLE ".$model->getPrefix()."article_categories_link(
- id INTEGER(10) NOT NULL DEFAULT 0 auto_increment PRIMARY KEY,
- article_id INTEGER(10) NOT NULL DEFAULT 0,
- category_id INTEGER(10) NOT NULL DEFAULT 0
- )";
-
- print("Creating the plog_article_categories_link table...<br/>");
-
- // create the table using the sql code above
- $result = $model->_db->Execute( $Table[1] );
- if( !$result )
- die( "Sorry, there was an error creating the table: ".$model->_db->ErrorMsg());
-
- $query = "SELECT article_id, category_id FROM ".$this->getPrefix()."articles";
- $result = $this->_db->Execute( $query );
- if( !$result )
- die( "There was a problem trying to get the links between article ids and old categories: ".$model->_db->ErrorMsg());
-
- while( $row = $result->FetchRow()) {
- // and the new mappings
- $queryAdd = "INSERT INTO ".$model->_db->getPrefix()."article_categories_link
- (article_id, category_id )
- VALUES(".$row["article_id"].", ".$row["category_id"].");";
- $result = $model->_db->Execute( $queryAdd );
- if( $result )
- print("Added link between article ".$row["article_id"]." and category ".$row["category_id"]."<br/>");
- else
- die( "Error adding link: ".$this->_model->ErrorMsg());
- }
-
- // if all went fine, we can now remove the field that is not needed anymore
- $queryDelete = "ALTER TABLE ".$model->_db->getPrefix()."plog_articles
- DROP COLUMN category_id";
- if( $model->_db->Execute( $queryDelete ))
- print("Changes completed!");
- else
- die("There was an error removing the category_id field from the articles table: ".$model->_db->ErrorMsg());
-?>
\ No newline at end of file
More information about the pLog-svn
mailing list