-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
68 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
class occtaxModuleUpgrader_2_12_2__2_12_3 extends jInstallerModule | ||
{ | ||
|
||
public $targetVersions = array( | ||
'2.12.3', | ||
); | ||
public $date = '2022-03-30'; | ||
|
||
function install() | ||
{ | ||
if ($this->firstDbExec()) { | ||
// Get variables | ||
$localConfig = jApp::configPath('naturaliz.ini.php'); | ||
$ini = new jIniFileModifier($localConfig); | ||
$srid = $ini->getValue('srid', 'naturaliz'); | ||
|
||
// SQL upgrade | ||
$this->useDbProfile('jauth_super'); | ||
$db = $this->dbConnection(); // A PLACER TOUJOUR DERRIERE $this->useDbProfile('jauth_super'); | ||
$sqlPath = $this->path . 'install/sql/import.sql'; | ||
$sqlTpl = jFile::read($sqlPath); | ||
$tpl = new jTpl(); | ||
$tpl->assign('SRID', $srid); | ||
$sql = $tpl->fetchFromString($sqlTpl, 'text'); | ||
$db->exec($sql); | ||
|
||
// Grant rights | ||
$sqlPath = $this->path . 'install/sql/grant_rights.sql'; | ||
$sqlTpl = jFile::read($sqlPath); | ||
$tpl = new jTpl(); | ||
$prof = jProfiles::get('jdb', $this->dbProfile, true); | ||
$tpl->assign('DBNAME', $prof['database']); | ||
$dbuser_readonly = $ini->getValue('dbuser_readonly', 'naturaliz'); | ||
$dbuser_owner = $ini->getValue('dbuser_owner', 'naturaliz'); | ||
if (empty($dbuser_readonly)) { | ||
$dbuser_readonly = 'naturaliz'; | ||
} | ||
if (empty($dbuser_owner)) { | ||
$dbuser_owner = 'lizmap'; | ||
} | ||
$tpl->assign('DBUSER_READONLY', $dbuser_readonly); | ||
$tpl->assign('DBUSER_OWNER', $dbuser_owner); | ||
$sql = $tpl->fetchFromString($sqlTpl, 'text'); | ||
|
||
// Try to reapply some rights on possibly newly created tables | ||
// If it fails, no worries as it can be done manually after upgrade | ||
try { | ||
$db->exec($sql); | ||
} catch (Exception $e) { | ||
jLog::log("Upgrade - Rights where not reapplied on database objects"); | ||
jLog::log($e->getMessage()); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters