Skip to content

Commit 4d3d96b

Browse files
committed
fixes to update
1 parent d9fd649 commit 4d3d96b

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

UserProfilesPlugin.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ class UserProfilesPlugin extends Omeka_Plugin_AbstractPlugin
1616
'public_content_top',
1717
'admin_users_browse_each',
1818
'after_delete_user',
19-
'initialize'
19+
'initialize',
20+
'upgrade',
2021
);
2122

2223
protected $_filters = array(
@@ -41,6 +42,24 @@ public function hookInitialize()
4142
add_translation_source(dirname(__FILE__) . '/languages');
4243
}
4344

45+
public function hookUpgrade($args)
46+
{
47+
$db = get_db();
48+
$old = $args['old_version'];
49+
$new = $args['new_version'];
50+
if (version_compare($new, '1.1.1', '>=')) {
51+
$sql = "
52+
ALTER TABLE `$db->UserProfilesProfile` CHANGE `modified` `modified` TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT '2000-01-01 00:00:00'
53+
";
54+
$db->query($sql);
55+
56+
$sql = "
57+
ALTER TABLE `$db->UserProfilesProfile` CHANGE `added` `added` TIMESTAMP NOT NULL DEFAULT '2000-01-01 00:00:00'
58+
";
59+
$db->query($sql);
60+
}
61+
}
62+
4463
public function hookInstall()
4564
{
4665
$db = get_db();

0 commit comments

Comments
 (0)