Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
drupal.org
page_title
Commits
6d498d64
Commit
6d498d64
authored
Aug 02, 2007
by
JohnAlbin
Browse files
Added db updates from DRUPAL-5--1.
parent
488ce265
Changes
2
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.txt
View file @
6d498d64
...
...
@@ -2,6 +2,8 @@ Page Title 5.x-1.1
* Added Russian translation by SadhooKlay.
* Removed inaccurate package description from .info file.
* Added ability to uninstall module.
* Increased length of page title to 255 characters for MySQL users.
#158104: Updated MySQL tables to use the system default table type instead of always using MyISAM.
Page Title 5.x-1.0
* Initial release.
page_title.install
View file @
6d498d64
...
...
@@ -5,31 +5,26 @@
* Implementation of hook_install().
*/
function
page_title_install
()
{
$result
=
FALSE
;
switch
(
$GLOBALS
[
'db_type'
])
{
case
'mysqli'
:
case
'mysql'
:
$
query1
=
db_query
(
"
CREATE TABLE IF NOT EXISTS
{
page_title
}
(
$
result
=
db_query
(
'
CREATE TABLE IF NOT EXISTS {page_title} (
nid INT NOT NULL,
page_title VARCHAR( 128 ) NOT NULL,
PRIMARY KEY ( `nid` )
) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;"
);
if
(
$query1
)
{
$created
=
TRUE
;
}
page_title VARCHAR(255) NOT NULL,
PRIMARY KEY (nid)
) /*!40100 DEFAULT CHARACTER SET utf8 */'
);
break
;
case
'pgsql'
:
$
query1
=
db_query
(
"CREATE TABLE
{
page_title
}
(
$
result
=
db_query
(
"CREATE TABLE
{
page_title
}
(
nid integer NOT NULL default '0',
page_title text NOT NULL default ''
);"
);
if
(
$query1
)
{
$created
=
TRUE
;
}
)"
);
break
;
}
if
(
$
c
re
ated
)
{
if
(
$re
sult
)
{
drupal_set_message
(
t
(
'Page title module installed successfully.'
));
}
else
{
...
...
@@ -43,3 +38,28 @@ function page_title_install() {
function
page_title_uninstall
()
{
db_query
(
'DROP TABLE {page_title}'
);
}
/**
* Increases page title in MySQL to 255 characters and modifies the MySQL table type from MYISAM to the user's default type.
*
* Implementation of hook_update_N().
*/
function
page_title_update_1
()
{
$items
=
array
();
switch
(
$GLOBALS
[
'db_type'
])
{
case
'mysqli'
:
case
'mysql'
:
$items
[]
=
update_sql
(
'ALTER TABLE {page_title} MODIFY COLUMN page_title VARCHAR(255) NOT NULL'
);
$items
[]
=
update_sql
(
'CREATE TEMPORARY TABLE {page_title_temp} AS SELECT * FROM {page_title}'
);
$items
[]
=
update_sql
(
'DROP TABLE {page_title}'
);
$items
[]
=
update_sql
(
'CREATE TABLE {page_title} (
nid INT NOT NULL,
page_title VARCHAR(255) NOT NULL,
PRIMARY KEY (nid)
) /*!40100 DEFAULT CHARACTER SET utf8 */;'
);
$items
[]
=
update_sql
(
'INSERT INTO {page_title} (nid, page_title)
SELECT nid, page_title FROM {page_title_temp}'
);
$items
[]
=
update_sql
(
'DROP TABLE {page_title_temp}'
);
}
return
$items
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment