Commit 95ffbce0 authored by Robert Lyon's avatar Robert Lyon Committed by Aaron Wells
Browse files

Bug 1557825: Remove view.numcolumns db column



As this is confusing debugging issues with view layout as the
view.numcolumns column is not actually used anymore for working
out the layout, but it's still being populated when a page is made.

behatnotneeded - existing tests will do

Change-Id: If90dff066201e7356601b08c9b7150cab8a77f45
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent b6b1260e
......@@ -42,7 +42,6 @@ class LeapImportAnnotation extends LeapImportArtefactPlugin {
'title' => '--',
'type' => 'portfolio',
'numrows' => 1,
'numcolumns' => 1,
'ctime' => $time,
'mtime' => $time,
'atime' => $time,
......
......@@ -42,7 +42,6 @@ class LeapImportComment extends LeapImportArtefactPlugin {
'title' => '--',
'type' => 'portfolio',
'numrows' => 1,
'numcolumns' => 1,
'ctime' => $time,
'mtime' => $time,
'atime' => $time,
......
......@@ -918,7 +918,6 @@ class PluginImportLeap extends PluginImport {
'layout' => null, // TODO
'tags' => self::get_entry_tags($entry),
'numrows' => 1,
'numcolumns' => 1,
'ownerformat' => FORMAT_NAME_DISPLAYNAME, // TODO
'owner' => $this->get('usr'),
);
......
......@@ -782,7 +782,6 @@
<FIELD NAME="submittedtime" TYPE="datetime" NOTNULL="false" />
<FIELD NAME="submittedstatus" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" />
<FIELD NAME="numrows" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="1" />
<FIELD NAME="numcolumns" TYPE="int" LENGTH="2" NOTNULL="true" />
<FIELD NAME="layout" TYPE="int" LENGTH="10" NOTNULL="false"/>
<FIELD NAME="skin" TYPE="int" LENGTH="10" NOTNULL="false"/>
<FIELD NAME="theme" TYPE="char" LENGTH="255" NOTNULL="false"/>
......
......@@ -4395,5 +4395,12 @@ function xmldb_core_upgrade($oldversion=0) {
log_debug('Multirecipient notifications plugin active');
}
if ($oldversion < 2016031600) {
log_debug('Removing the obsolete "view.numcolumns" column');
$table = new XMLDBTable('view');
$field = new XMLDBField('numcolumns');
drop_field($table, $field);
}
return $status;
}
......@@ -2334,7 +2334,6 @@ function install_system_grouphomepage_view() {
$view = View::create(array(
'type' => 'grouphomepage',
'owner' => 0,
'numcolumns' => 2,
'numrows' => 1,
'columnsperrow' => array((object)array('row' => 1, 'columns' => 1)),
'template' => 1,
......
......@@ -104,20 +104,6 @@ class ViewTest extends MaharaUnitTest {
}
}
/**
* Test that removing a column updates numcolumns
*/
public function testRemovecolumn() {
$before = $this->view->get_row_datastructure();
$this->view->removecolumn(array('column' => 1, 'row' => 1));
$after = $this->view->get_row_datastructure();
$this->assertEquals(count($before), count($after));
$this->assertEquals(count($before[1]) - 1, count($after[1]));
}
/**
* test that when we delete a view,
* it actually gets deleted from the database
......
......@@ -2569,7 +2569,6 @@ function install_system_profile_view() {
$view = View::create(array(
'type' => 'profile',
'owner' => 0,
'numcolumns' => 2,
'numrows' => 1,
'columnsperrow' => array((object)array('row' => 1, 'columns' => 2)),
'ownerformat' => FORMAT_NAME_PREFERREDNAME,
......@@ -2616,7 +2615,6 @@ function install_system_dashboard_view() {
$view = View::create(array(
'type' => 'dashboard',
'owner' => 0,
'numcolumns' => 2,
'numrows' => 1,
'columnsperrow' => array((object)array('row' => 1, 'columns' => 2)),
'ownerformat' => FORMAT_NAME_PREFERREDNAME,
......
......@@ -16,7 +16,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/wiki/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date.
$config->version = 2016030600;
$config->version = 2016031600;
$config->series = '16.04';
$config->release = '16.04dev';
$config->minupgradefrom = 2012080604;
......
......@@ -38,7 +38,6 @@ class View {
private $ownerobj;
private $groupobj;
private $institutionobj;
private $numcolumns; // now redundant
private $columnsperrow; // assoc array of rows set and get using view_rows_columns db table
private $numrows;
private $layout;
......@@ -555,7 +554,6 @@ class View {
// Create the view
$defaultdata = array(
'numcolumns' => 2,
'numrows' => 1,
'columnsperrow' => self::default_columnsperrow(),
'template' => 0,
......@@ -5420,7 +5418,6 @@ class View {
public function copy_contents($template) {
$artefactcopies = array(); // Correspondence between original artefact ids and id of the copy
$this->set('numcolumns', $template->get('numcolumns'));
$this->set('numrows', $template->get('numrows'));
$this->set('layout', $template->get('layout'));
if ($template->get('owner') == 0
......
......@@ -40,7 +40,6 @@ if (!$USER->can_edit_view($view)) {
$view->set_edit_nav();
$view->set_user_theme();
$numrows = $view->get('numrows');
$numcolumns = $view->get('numcolumns');
$layoutcolumns = View::$layoutcolumns; // static, all possible column width combinations
$layoutrows = $view->get_layoutrows();
$maxlayoutrows = View::$maxlayoutrows; // static, max possible rows for custom layouts
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment