diff --git a/blocks/search/block_search.php b/blocks/search/block_search.php index f75fa1668ef..cfc2fd26d07 100644 --- a/blocks/search/block_search.php +++ b/blocks/search/block_search.php @@ -16,7 +16,7 @@ function init() { $this->title = get_string('blockname', 'block_search'); $this->cron = 1; - $this->version = 2007081100; + $this->version = 2007112700; } //init // only one instance of this block is required diff --git a/blocks/search/db/install.xml b/blocks/search/db/install.xml index d71fd708470..234e77e1479 100644 --- a/blocks/search/db/install.xml +++ b/blocks/search/db/install.xml @@ -12,8 +12,8 @@ - - + + diff --git a/blocks/search/db/upgrade.php b/blocks/search/db/upgrade.php index d9d5d856bd0..7eece96a31c 100644 --- a/blocks/search/db/upgrade.php +++ b/blocks/search/db/upgrade.php @@ -107,7 +107,29 @@ function xmldb_block_search_upgrade($oldversion=0) { $result = $result && change_field_default($table, $field); } + if ($result && $oldversion < 2007112700) { + + /// Truncate the block_search_documents table + execute_sql("TRUNCATE TABLE {$CFG->prefix}block_search_documents", true); + + /// Changing type of field docdate on table block_search_documents to int + $table = new XMLDBTable('block_search_documents'); + $field = new XMLDBField('docdate'); + $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'url'); + + /// Launch change of type for field docdate + $result = $result && change_field_type($table, $field); + + /// Changing type of field updated on table block_search_documents to int + $table = new XMLDBTable('block_search_documents'); + $field = new XMLDBField('updated'); + $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'docdate'); + + /// Launch change of type for field updated + $result = $result && change_field_type($table, $field); + } + return $result; } -?> +?> \ No newline at end of file