Skip to content

Commit

Permalink
Dev: removed templatereplacejs
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed May 5, 2017
1 parent d3fb1db commit 44f88f3
Showing 1 changed file with 0 additions and 58 deletions.
58 changes: 0 additions & 58 deletions application/helpers/update/updatedb_helper.php
Expand Up @@ -1132,8 +1132,6 @@ function db_upgrade_all($iOldDBVersion, $bSilent=false) {
{
$oTransaction = $oDB->beginTransaction();
//Replace by <script type="text/javascript" src="{TEMPLATEURL}template.js"></script> by {TEMPLATEJS}

$replacedTemplate=replaceTemplateJS();
$oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>163),"stg_name='DBVersion'");
$oTransaction->commit();
}
Expand Down Expand Up @@ -2999,62 +2997,6 @@ function dropSecondaryKeyMSSQL($sFieldName, $sTableName)
}
}

function replaceTemplateJS(){
$usertemplaterootdir=Yii::app()->getConfig("usertemplaterootdir");

if (!$usertemplaterootdir) {return false;}
$countstartpage=0;
$counterror=0;
$errortemplate=array();
if ($handle = opendir($usertemplaterootdir))
{
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $file != ".." && is_dir("{$usertemplaterootdir}/{$file}")) {
$fname = "$usertemplaterootdir/$file/startpage.pstpl";
if (is_file($fname))
{
if(is_writable($fname)){
$fhandle = fopen($fname,"r");
$content = fread($fhandle,filesize($fname));
$content = str_replace("<script type=\"text/javascript\" src=\"{TEMPLATEURL}template.js\"></script>", "{TEMPLATEJS}", $content);
$fhandle = fopen($fname,"w");
fwrite($fhandle,$content);
fclose($fhandle);
if(strpos($content, "{TEMPLATEJS}")===false)
{
$counterror++;
$errortemplate[]=$file;
}
}else{
$counterror++;
}
$countstartpage++;
}
}
}
closedir($handle);
}
if($counterror)
{
echo gT("Some user templates can not be updated, please add the placeholder {TEMPLATEJS} in your startpage.pstpl manually.");
echo "<br />";
echo gT("Template(s) to be verified :");
echo implode(",",$errortemplate);
}
else
{
if($countstartpage){
echo sprintf(gT("All %s user templates updated."),$countstartpage);
}
}
if($counterror){
return false;
}else{
return $countstartpage;
}
}

/**
* Make sure all active tables have the right sized token field
*
Expand Down

0 comments on commit 44f88f3

Please sign in to comment.