Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit f181b0a

Browse files
author
Jamie Snape
committed
Fix bad spelling mistakes in database schema and standardize plurals
1 parent b8d8de3 commit f181b0a

22 files changed

+342
-259
lines changed

core/database/mysql/3.2.17.sql renamed to core/database/mysql/3.2.18.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- MIDAS Server. Copyright Kitware SAS. Licensed under the Apache License 2.0.
22

3-
-- MySQL core database, version 3.2.17
3+
-- MySQL core database, version 3.2.18
44

55
CREATE TABLE IF NOT EXISTS `activedownload` (
66
`activedownload_id` bigint(20) NOT NULL AUTO_INCREMENT,
@@ -73,7 +73,7 @@ CREATE TABLE IF NOT EXISTS `feed` (
7373
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
7474
`user_id` bigint(20) NOT NULL,
7575
`type` tinyint(4) NOT NULL,
76-
`ressource` varchar(255) NOT NULL,
76+
`resource` varchar(255) NOT NULL,
7777
PRIMARY KEY (`feed_id`)
7878
) DEFAULT CHARSET=utf8;
7979

@@ -101,8 +101,8 @@ CREATE TABLE IF NOT EXISTS `feedpolicyuser` (
101101

102102
CREATE TABLE IF NOT EXISTS `folder` (
103103
`folder_id` bigint(20) NOT NULL AUTO_INCREMENT,
104-
`left_indice` bigint(20) NOT NULL,
105-
`right_indice` bigint(20) NOT NULL,
104+
`left_index` bigint(20) NOT NULL,
105+
`right_index` bigint(20) NOT NULL,
106106
`parent_id` bigint(20) NOT NULL DEFAULT '0',
107107
`name` varchar(255) NOT NULL,
108108
`description` text NOT NULL,
@@ -114,8 +114,8 @@ CREATE TABLE IF NOT EXISTS `folder` (
114114
`date_creation` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
115115
PRIMARY KEY (`folder_id`),
116116
KEY (`parent_id`),
117-
KEY (`left_indice`),
118-
KEY (`right_indice`)
117+
KEY (`left_index`),
118+
KEY (`right_index`)
119119
) DEFAULT CHARSET=utf8;
120120

121121
CREATE TABLE IF NOT EXISTS `folderpolicygroup` (

core/database/pgsql/3.2.17.sql renamed to core/database/pgsql/3.2.18.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- MIDAS Server. Copyright Kitware SAS. Licensed under the Apache License 2.0.
22

3-
-- PostgreSQL core database, version 3.2.17
3+
-- PostgreSQL core database, version 3.2.18
44

55
SET client_encoding = 'UTF8';
66
SET default_with_oids = FALSE;
@@ -70,7 +70,7 @@ CREATE TABLE IF NOT EXISTS "feed" (
7070
"date" timestamp without time zone NOT NULL,
7171
"user_id" bigint NOT NULL,
7272
"type" integer NOT NULL,
73-
"ressource" character varying(256) NOT NULL
73+
"resource" character varying(256) NOT NULL
7474
);
7575

7676
CREATE TABLE IF NOT EXISTS "feed2community" (
@@ -97,8 +97,8 @@ CREATE TABLE IF NOT EXISTS "feedpolicyuser" (
9797

9898
CREATE TABLE IF NOT EXISTS "folder" (
9999
"folder_id" serial PRIMARY KEY,
100-
"left_indice" bigint NOT NULL,
101-
"right_indice" bigint NOT NULL,
100+
"left_index" bigint NOT NULL,
101+
"right_index" bigint NOT NULL,
102102
"parent_id" bigint DEFAULT 0::bigint NOT NULL,
103103
"name" character varying(256) NOT NULL,
104104
"description" text NOT NULL,
@@ -110,9 +110,9 @@ CREATE TABLE IF NOT EXISTS "folder" (
110110
"date_creation" timestamp without time zone
111111
);
112112

113-
CREATE INDEX "folder_idx_left_indice" ON "folder" ("left_indice");
113+
CREATE INDEX "folder_idx_left_index" ON "folder" ("left_index");
114114
CREATE INDEX "folder_idx_parent_id" ON "folder" ("parent_id");
115-
CREATE INDEX "folder_idx_right_indice" ON "folder" ("right_indice");
115+
CREATE INDEX "folder_idx_right_index" ON "folder" ("right_index");
116116

117117
CREATE TABLE IF NOT EXISTS "folderpolicygroup" (
118118
"id" serial PRIMARY KEY,

core/database/sqlite/3.2.17.sql renamed to core/database/sqlite/3.2.18.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- MIDAS Server. Copyright Kitware SAS. Licensed under the Apache License 2.0.
22

3-
-- SQLite core database, version 3.2.17
3+
-- SQLite core database, version 3.2.18
44

55
CREATE TABLE IF NOT EXISTS "activedownload" (
66
"activedownload_id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
@@ -67,7 +67,7 @@ CREATE TABLE IF NOT EXISTS "feed" (
6767
"date" TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
6868
"user_id" INTEGER NOT NULL,
6969
"type" INTEGER NOT NULL,
70-
"ressource" TEXT NOT NULL
70+
"resource" TEXT NOT NULL
7171
);
7272

7373
CREATE TABLE IF NOT EXISTS "feed2community" (
@@ -94,8 +94,8 @@ CREATE TABLE IF NOT EXISTS "feedpolicyuser" (
9494

9595
CREATE TABLE IF NOT EXISTS "folder" (
9696
"folder_id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
97-
"left_indice" INTEGER NOT NULL,
98-
"right_indice" INTEGER NOT NULL,
97+
"left_index" INTEGER NOT NULL,
98+
"right_index" INTEGER NOT NULL,
9999
"parent_id" INTEGER NOT NULL DEFAULT 0,
100100
"name" TEXT NOT NULL,
101101
"description" TEXT NOT NULL,
@@ -107,9 +107,9 @@ CREATE TABLE IF NOT EXISTS "folder" (
107107
"date_creation" TEXT NOT NULL DEFAULT '0000-00-00 00:00:00'
108108
);
109109

110-
CREATE INDEX IF NOT EXISTS "folder_left_indice_idx" ON "folder" ("left_indice");
110+
CREATE INDEX IF NOT EXISTS "folder_left_index_idx" ON "folder" ("left_index");
111111
CREATE INDEX IF NOT EXISTS "folder_parent_id_idx" ON "folder" ("parent_id");
112-
CREATE INDEX IF NOT EXISTS "folder_right_indice_idx" ON "folder" ("right_indice");
112+
CREATE INDEX IF NOT EXISTS "folder_right_index_idx" ON "folder" ("right_index");
113113

114114
CREATE TABLE IF NOT EXISTS "folderpolicygroup" (
115115
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,

core/database/upgrade/3.2.18.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
/*=========================================================================
3+
MIDAS Server
4+
Copyright (c) Kitware SAS. 26 rue Louis Guérin. 69100 Villeurbanne, FRANCE
5+
All rights reserved.
6+
More information http://www.kitware.com
7+
8+
Licensed under the Apache License, Version 2.0 (the "License");
9+
you may not use this file except in compliance with the License.
10+
You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0.txt
13+
14+
Unless required by applicable law or agreed to in writing, software
15+
distributed under the License is distributed on an "AS IS" BASIS,
16+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
See the License for the specific language governing permissions and
18+
limitations under the License.
19+
=========================================================================*/
20+
21+
/** Upgrade the core to version 3.2.18. */
22+
class Upgrade_3_2_18 extends MIDASUpgrade
23+
{
24+
25+
/** Upgrade a MySQL database. */
26+
public function mysql()
27+
{
28+
$this->db->query("ALTER TABLE `folder` DROP KEY `left_indice`;");
29+
$this->db->query("ALTER TABLE `folder` DROP KEY `right_indice`;");
30+
$this->db->query("ALTER TABLE `folder` CHANGE `left_indice` `left_index` bigint(20) NOT NULL;");
31+
$this->db->query("ALTER TABLE `folder` CHANGE `right_indice` `right_index` bigint(20) NOT NULL;");
32+
$this->db->query("ALTER TABLE `folder` ADD KEY (`left_index`);");
33+
$this->db->query("ALTER TABLE `folder` ADD KEY (`right_index`);");
34+
$this->db->query("ALTER TABLE `feed` CHANGE `ressource` `resource` varchar(255) NOT NULL;");
35+
}
36+
37+
/** Upgrade a PostgreSQL database. */
38+
public function pgsql()
39+
{
40+
$this->db->query("DROP INDEX IF EXISTS folder_idx_left_indice;");
41+
$this->db->query("DROP INDEX IF EXISTS folder_idx_right_indice;");
42+
$this->db->query("ALTER TABLE folder RENAME left_indice TO left_index;");
43+
$this->db->query("ALTER TABLE folder RENAME right_indice TO right_index;");
44+
$this->db->query("CREATE INDEX folder_idx_left_index ON folder (left_index);");
45+
$this->db->query("CREATE INDEX folder_idx_right_index ON folder (right_index);");
46+
$this->db->query("ALTER TABLE feed RENAME ressource TO resource;");
47+
}
48+
}

core/models/base/FeedModelBase.php

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __construct()
3333
'date' => array('type' => MIDAS_DATA),
3434
'user_id' => array('type' => MIDAS_DATA),
3535
'type' => array('type' => MIDAS_DATA),
36-
'ressource' => array('type' => MIDAS_DATA),
36+
'resource' => array('type' => MIDAS_DATA),
3737
'communities' => array(
3838
'type' => MIDAS_MANY_TO_MANY,
3939
'model' => 'Community',
@@ -109,11 +109,11 @@ public function getFeedsByCommunity($loggedUserDao, $communityDao, $policy = 0,
109109
*
110110
* @return FeedDao
111111
*/
112-
public function createFeed($userDao, $type, $ressource, $communityDao = null)
112+
public function createFeed($userDao, $type, $resource, $communityDao = null)
113113
{
114-
if (!$userDao instanceof UserDao && !is_numeric($type) && !is_object($ressource)
114+
if (!$userDao instanceof UserDao && !is_numeric($type) && !is_object($resource)
115115
) {
116-
throw new Zend_Exception("Error in parameters, userdao, type, and ressource.");
116+
throw new Zend_Exception("Error in parameters, userdao, type, and resource.");
117117
}
118118
$feed = MidasLoader::newDao('FeedDao');
119119
$feed->setUserId($userDao->getKey());
@@ -122,51 +122,51 @@ public function createFeed($userDao, $type, $ressource, $communityDao = null)
122122
switch ($type) {
123123
case MIDAS_FEED_CREATE_COMMUNITY:
124124
case MIDAS_FEED_UPDATE_COMMUNITY:
125-
if (!$ressource instanceof CommunityDao) {
126-
throw new Zend_Exception("Error in parameter ressource, expecting CommunityDao, type:".$type);
125+
if (!$resource instanceof CommunityDao) {
126+
throw new Zend_Exception("Error in parameter resource, expecting CommunityDao, type:".$type);
127127
}
128-
$feed->setRessource($ressource->getKey());
128+
$feed->setResource($resource->getKey());
129129
break;
130130
case MIDAS_FEED_COMMUNITY_INVITATION:
131-
if (!$ressource instanceof CommunityInvitationDao) {
131+
if (!$resource instanceof CommunityInvitationDao) {
132132
throw new Zend_Exception(
133-
"Error in parameter ressource, expecting CommunityInvitationDao, type:".$type
133+
"Error in parameter resource, expecting CommunityInvitationDao, type:".$type
134134
);
135135
}
136-
$feed->setRessource($ressource->getKey());
136+
$feed->setResource($resource->getKey());
137137
break;
138138
case MIDAS_FEED_CREATE_FOLDER:
139-
if (!$ressource instanceof FolderDao) {
140-
throw new Zend_Exception("Error in parameter ressource, expecting FolderDao, type:".$type);
139+
if (!$resource instanceof FolderDao) {
140+
throw new Zend_Exception("Error in parameter resource, expecting FolderDao, type:".$type);
141141
}
142-
$feed->setRessource($ressource->getKey());
142+
$feed->setResource($resource->getKey());
143143
break;
144144
case MIDAS_FEED_CREATE_LINK_ITEM:
145145
case MIDAS_FEED_CREATE_ITEM:
146-
if (!$ressource instanceof ItemDao) {
147-
throw new Zend_Exception("Error in parameter ressource, expecting ItemDao, type:".$type);
146+
if (!$resource instanceof ItemDao) {
147+
throw new Zend_Exception("Error in parameter resource, expecting ItemDao, type:".$type);
148148
}
149-
$feed->setRessource($ressource->getKey());
149+
$feed->setResource($resource->getKey());
150150
break;
151151
case MIDAS_FEED_CREATE_REVISION:
152-
if (!$ressource instanceof ItemRevisionDao) {
153-
throw new Zend_Exception("Error in parameter ressource, expecting ItemRevisionDao, type:".$type);
152+
if (!$resource instanceof ItemRevisionDao) {
153+
throw new Zend_Exception("Error in parameter resource, expecting ItemRevisionDao, type:".$type);
154154
}
155-
$feed->setRessource($ressource->getKey());
155+
$feed->setResource($resource->getKey());
156156
break;
157157
case MIDAS_FEED_CREATE_USER:
158-
if (!$ressource instanceof UserDao) {
159-
throw new Zend_Exception("Error in parameter ressource, expecting UserDao, type:".$type);
158+
if (!$resource instanceof UserDao) {
159+
throw new Zend_Exception("Error in parameter resource, expecting UserDao, type:".$type);
160160
}
161-
$feed->setRessource($ressource->getKey());
161+
$feed->setResource($resource->getKey());
162162
break;
163163
case MIDAS_FEED_DELETE_COMMUNITY:
164164
case MIDAS_FEED_DELETE_FOLDER:
165165
case MIDAS_FEED_DELETE_ITEM:
166-
if (!is_string($ressource)) {
167-
throw new Zend_Exception("Error in parameter ressource, expecting string, type:".$type);
166+
if (!is_string($resource)) {
167+
throw new Zend_Exception("Error in parameter resource, expecting string, type:".$type);
168168
}
169-
$feed->setRessource($ressource);
169+
$feed->setResource($resource);
170170
break;
171171
default:
172172
throw new Zend_Exception("Unable to find an expected type of feed");

core/models/base/FolderModelBase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ public function __construct()
3232

3333
$this->_mainData = array(
3434
'folder_id' => array('type' => MIDAS_DATA),
35-
'left_indice' => array('type' => MIDAS_DATA),
36-
'right_indice' => array('type' => MIDAS_DATA),
35+
'left_index' => array('type' => MIDAS_DATA),
36+
'right_index' => array('type' => MIDAS_DATA),
3737
'parent_id' => array('type' => MIDAS_DATA),
3838
'name' => array('type' => MIDAS_DATA),
3939
'description' => array('type' => MIDAS_DATA),

core/models/dao/FeedDao.php

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
* @method void setUserId(int $userId)
3030
* @method int getType()
3131
* @method void setType(int $type)
32+
* @method void setResource(string $resource)
3233
* @method array getCommunities()
3334
* @method void setCommunities(array $communities)
3435
* @method UserDao getUser()
@@ -47,7 +48,7 @@ class FeedDao extends AppDao
4748
/**
4849
* Return the resource.
4950
*
50-
* @return string
51+
* @return mixed
5152
* @throws Zend_Exception
5253
*/
5354
public function getResource()
@@ -59,32 +60,32 @@ public function getResource()
5960
case MIDAS_FEED_UPDATE_COMMUNITY:
6061
$model = MidasLoader::loadModel('Community');
6162

62-
return $model->load($this->ressource);
63+
return $model->load($this->resource);
6364
case MIDAS_FEED_COMMUNITY_INVITATION:
6465
$model = MidasLoader::loadModel('CommunityInvitation');
6566

66-
return $model->load($this->ressource);
67+
return $model->load($this->resource);
6768
case MIDAS_FEED_CREATE_FOLDER:
6869
$model = MidasLoader::loadModel('Folder');
6970

70-
return $model->load($this->ressource);
71+
return $model->load($this->resource);
7172
case MIDAS_FEED_CREATE_ITEM:
7273
case MIDAS_FEED_CREATE_LINK_ITEM:
7374
$model = MidasLoader::loadModel('Item');
7475

75-
return $model->load($this->ressource);
76+
return $model->load($this->resource);
7677
case MIDAS_FEED_CREATE_REVISION:
7778
$model = MidasLoader::loadModel('ItemRevision');
7879

79-
return $model->load($this->ressource);
80+
return $model->load($this->resource);
8081
case MIDAS_FEED_CREATE_USER:
8182
$model = MidasLoader::loadModel('User');
8283

83-
return $model->load($this->ressource);
84+
return $model->load($this->resource);
8485
case MIDAS_FEED_DELETE_COMMUNITY:
8586
case MIDAS_FEED_DELETE_FOLDER:
8687
case MIDAS_FEED_DELETE_ITEM:
87-
return $this->ressource;
88+
return $this->resource;
8889
default:
8990
throw new Zend_Exception('Unable to define the type of feed.');
9091
}
@@ -93,8 +94,8 @@ public function getResource()
9394
/**
9495
* Return the resource.
9596
*
96-
* @deprecated
97-
* @return string
97+
* @deprecated since 3.3.0
98+
* @return mixed
9899
*/
99100
public function getRessource()
100101
{
@@ -104,18 +105,8 @@ public function getRessource()
104105
/**
105106
* Set the resource.
106107
*
107-
* @param $resource resource
108-
*/
109-
public function setResource($resource)
110-
{
111-
$this->ressource = $resource;
112-
}
113-
114-
/**
115-
* Set the resource.
116-
*
117-
* @deprecated
118-
* @param $resource resource
108+
* @deprecated since 3.3.0
109+
* @param string $resource resource
119110
*/
120111
public function setRessource($resource)
121112
{

0 commit comments

Comments
 (0)