-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextension.driver.php
More file actions
45 lines (38 loc) · 1.44 KB
/
extension.driver.php
File metadata and controls
45 lines (38 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
declare(strict_types=1);
if (!file_exists(__DIR__.'/vendor/autoload.php')) {
throw new Exception(sprintf(
'Could not find composer autoload file %s. Did you run `composer update` in %s?',
__DIR__.'/vendor/autoload.php',
__DIR__
));
}
require_once __DIR__.'/vendor/autoload.php';
use pointybeard\Symphony\Extended;
// This file is included automatically in the composer autoloader, however,
// Symphony might try to include it again which would cause a fatal error.
// Check if the class already exists before declaring it again.
if (!class_exists('\\Extension_Reverse_Regex_Field')) {
class Extension_Reverse_Regex_Field extends Extended\AbstractExtension
{
public function uninstall(): bool
{
Symphony::Database()->query('DROP TABLE `tbl_fields_reverse_regex`');
}
public function install(): bool
{
parent::install();
return Symphony::Database()->query(
"CREATE TABLE `tbl_fields_reverse_regex` (
`id` int(11) unsigned NOT NULL auto_increment,
`field_id` int(11) unsigned NOT NULL,
`pattern` varchar(100) NOT NULL,
`unique` enum('yes','no') NOT NULL default 'no',
PRIMARY KEY (`id`),
UNIQUE KEY `field_id` (`field_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
"
);
}
}
}