diff --git a/extension.driver.php b/extension.driver.php
index a06444d..fcf9ef4 100755
--- a/extension.driver.php
+++ b/extension.driver.php
@@ -58,8 +58,8 @@ public function appendPreferences($context){
$group->appendChild(new XMLElement('legend', __('Export Ensemble')));
- $div = new XMLElement('div', NULL, array('id' => 'file-actions', 'class' => 'label'));
- $span = new XMLElement('span', NULL, array('class' => 'frame'));
+ $div = new XMLElement('div', null, array('id' => 'file-actions', 'class' => 'label'));
+ $span = new XMLElement('span', null, array('class' => 'frame'));
$span->appendChild(new XMLElement('button', __('Save Install Files'), array('name' => 'action[save-install-files]', 'type' => 'submit')));
@@ -119,17 +119,17 @@ private function __saveInstallFiles(){
$config_template = $this->__createDefaultConfigFile();
// Write the install files
- if(FALSE !== @file_put_contents(DOCROOT . '/install/includes/install.sql', $sql_schema));
+ if(false !== @file_put_contents(DOCROOT . '/install/includes/install.sql', $sql_schema));
else {
Administration::instance()->Page->pageAlert(__('An error occurred while trying to write the install.sql file. Check the file permissions.'), Alert::ERROR);
return;
}
- if(FALSE !== @file_put_contents(DOCROOT . '/install/includes/config_default.php', $config_template));
+ if(false !== @file_put_contents(DOCROOT . '/install/includes/config_default.php', $config_template));
else {
Administration::instance()->Page->pageAlert(__('An error occurred while trying to write the config_default.php file. Check the file permissions.'), Alert::ERROR);
return;
}
- if(FALSE !== @file_put_contents(DOCROOT . '/workspace/install.sql', $sql_data));
+ if(false !== @file_put_contents(DOCROOT . '/workspace/install.sql', $sql_data));
else {
Administration::instance()->Page->pageAlert(__('An error occurred while trying to write the workspace/install.sql file. Check the file permissions.'), Alert::ERROR);
return;
@@ -209,7 +209,7 @@ private function __getDataTables($data_tables){
private function __dumpSchema($dump, $structure_tables, $tbl_prefix){
// Create variables for the dump files
- $sql_schema = NULL;
+ $sql_schema = null;
// Grab the schema
foreach($structure_tables as $t) $sql_schema .= $dump->export($t, MySQLDump::STRUCTURE_ONLY);
@@ -221,14 +221,14 @@ private function __dumpSchema($dump, $structure_tables, $tbl_prefix){
);
// Remove any AUTO_INCREMENT counts
- $sql_schema = preg_replace('/AUTO_INCREMENT=\d+/i', NULL, $sql_schema);
+ $sql_schema = preg_replace('/AUTO_INCREMENT=\d+/i', null, $sql_schema);
return $sql_schema;
}
private function __dumpData($dump, $data_tables, $tbl_prefix){
// Create variables for the dump files
- $sql_data = NULL;
+ $sql_data = null;
// Field data and entry data schemas needs to be apart of the workspace sql dump
$sql_data = $dump->export('tbl_fields_%', MySQLDump::ALL);
@@ -280,7 +280,7 @@ private function __createZipArchive($config_template, $sql_schema, $sql_data){
$archive = new ZipArchive;
$res = $archive->open(TMP . '/ensemble.tmp.zip', ZipArchive::CREATE);
- if ($res === TRUE) {
+ if ($res === true) {
$this->__addFolderToArchive($archive, 'extensions', DOCROOT);
$this->__addFolderToArchive($archive, 'symphony', DOCROOT);
$this->__addFolderToArchive($archive, 'workspace', DOCROOT);
@@ -329,7 +329,7 @@ private function __createZipArchive($config_template, $sql_schema, $sql_data){
}
}
- private function __addFolderToArchive(&$archive, $path, $parent=NULL){
+ private function __addFolderToArchive(&$archive, $path, $parent = null){
$iterator = new DirectoryIterator($path);
foreach($iterator as $file){
if($file->isDot() || preg_match('/^\./', $file->getFilename())) continue;
@@ -338,7 +338,7 @@ private function __addFolderToArchive(&$archive, $path, $parent=NULL){
$this->__addFolderToArchive($archive, $file->getPathname(), $parent);
}
- else $archive->addFile($file->getPathname(), ltrim(str_replace($parent, NULL, $file->getPathname()), '/'));
+ else $archive->addFile($file->getPathname(), ltrim(str_replace($parent, null, $file->getPathname()), '/'));
}
}
}
diff --git a/extension.meta.xml b/extension.meta.xml
index 566fcc1..1115624 100644
--- a/extension.meta.xml
+++ b/extension.meta.xml
@@ -18,6 +18,9 @@
+
+ - Updated for Symphony 4.x
+
- Updated Russian translation
@@ -109,4 +112,4 @@
- Moved `installer.tpl`, found in the main S2 repository, into the /lib folder
-
\ No newline at end of file
+
diff --git a/lib/class.mysqldump.php b/lib/class.mysqldump.php
index e0f34e9..46d6be9 100755
--- a/lib/class.mysqldump.php
+++ b/lib/class.mysqldump.php
@@ -1,36 +1,36 @@
_connection = $connection;
}
- public function export($match=null, $flag=self::ALL, $condition=NULL){
- $data = NULL;
+ public function export($match = null, $flag = self::ALL, $condition = null){
+ $data = null;
$tables = $this->__getTables($match);
foreach ($tables as $name => $info){
-
+
if($flag == self::ALL || $flag == self::STRUCTURE_ONLY){
$data .= self::CRLF . "-- *** STRUCTURE: `{$name}` ***" . self::CRLF;
$data .= "DROP TABLE IF EXISTS `{$name}`;" . self::CRLF;
$data .= $this->__dumpTableSQL($name, $info['type'], $info['fields'], $info['indexes']);
}
-
+
if($flag == self::ALL || $flag == self::DATA_ONLY){
$data .= self::CRLF . "-- *** DATA: `$name` ***" . self::CRLF;
if(strtoupper($info['type']) == 'INNODB'){
$data .= 'SET FOREIGN_KEY_CHECKS = 0;' . self::CRLF;
}
-
+
$data .= $this->__dumpTableData ($name, $info['fields'], $condition);
if(strtoupper($info['type']) == 'INNODB'){
$data .= 'SET FOREIGN_KEY_CHECKS = 1;' . self::CRLF;
@@ -40,41 +40,41 @@ public function export($match=null, $flag=self::ALL, $condition=NULL){
return $data;
}
-
- private function __dumpTableData($name, $fields, $condition=NULL){
+
+ private function __dumpTableData($name, $fields, $condition = null){
$fieldList = join (', ', array_map (create_function ('$x', 'return "`$x`";'), array_keys ($fields)));
-
+
$query = "SELECT {$fieldList} FROM `{$name}`";
-
+
if(!is_null($condition)){
$query .= ' WHERE ' . $condition;
}
-
+
$rows = $this->_connection->fetch ($query);
- $value = NULL;
+ $value = null;
- if(!is_array($rows) || empty($rows)) return NULL;
+ if(!is_array($rows) || empty($rows)) return null;
foreach ($rows as $row){
$value .= "INSERT INTO `{$name}` ({$fieldList}) VALUES (";
$fieldValues = array();
-
+
foreach ($fields as $fieldName => $info){
$fieldValue = $row[$fieldName];
if($info['null'] == 1 && strlen(trim($fieldValue)) == 0){
- $fieldValues[] = 'NULL';
+ $fieldValues[] = 'null';
}
-
+
elseif(substr($info['type'], 0, 4) == 'enum'){
$fieldValues[] = "'{$fieldValue}'";
}
-
+
elseif(is_numeric ($fieldValue)){
$fieldValues[] = $fieldValue;
}
-
+
else{
$fieldValues[] = "'" . $this->_connection->cleanValue($fieldValue) . "'";
}
@@ -86,7 +86,7 @@ private function __dumpTableData($name, $fields, $condition=NULL){
return $value;
}
-
+
private function __dumpTableSQL($table, $type, $fields, $indexes){
$query = "SHOW CREATE TABLE `{$table}`";
@@ -95,9 +95,9 @@ private function __dumpTableSQL($table, $type, $fields, $indexes){
return $result[1] . ";" . self::CRLF;
}
- private function __getTables($match=null){
- $query = 'SHOW TABLES' . (!is_null($match) ? " LIKE '$match'" : NULL);
-
+ private function __getTables($match = null){
+ $query = 'SHOW TABLES' . (!is_null($match) ? " LIKE '$match'" : null);
+
$rows = $this->_connection->fetch ($query);
$rows = array_map (create_function ('$x', 'return array_values ($x);'), $rows);
$tables = array_map (create_function ('$x', 'return $x[0];'), $rows);
@@ -138,7 +138,7 @@ private function __getTableFields($table){
'default' => $default,
'extra' => $extra
);
-
+
$result[$name] = $field;
}