diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..030bc20 --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ +# OS +.DS_Store +Thumbs.db + +# IDEs +.buildpath +.project +.settings/ +.build/ +.external*/ +.idea/ +nbproject/ + +# composer related +vendor/ + +# build +build/ + +# custom +runonceDebug.php \ No newline at end of file diff --git a/system/modules/semantic_html5/config/runonceDebug.php b/system/modules/semantic_html5/config/runonceDebug.php deleted file mode 100644 index a492c7f..0000000 --- a/system/modules/semantic_html5/config/runonceDebug.php +++ /dev/null @@ -1,193 +0,0 @@ -booDebug) - { - echo "

DEBUG semantic_html5 runonce

"; - echo "

LOGS

"; - } - - $arrPidResult = $this->Database - ->prepare("SELECT pid FROM `tl_content` WHERE type = 'semantic_html5' GROUP BY pid") - ->execute() - ->fetchAllAssoc(); - - $arrArticleResult = array(); - - foreach ($arrPidResult AS $arrPid) - { - $objResult = $this->Database - ->prepare("SELECT id, pid, type, sorting, sh5_pid, sh5_type, sh5_tag FROM `tl_content` WHERE type = 'semantic_html5' AND pid = ? ORDER BY sorting ASC") - ->execute($arrPid['pid']); - - while ($objResult->next()) - { - $arrArticleResult[$arrPid['pid']][] = $objResult->row(); - } - } - - $arrSets = array(); - - foreach ($arrArticleResult AS $pid => $arrContentElems) - { - $arrRemainContentElems = $arrContentElems; - $arrNoEndTag = array(); - $arrLastID = count($arrContentElems); - - for ($i = 0; $i <= $arrLastID; $i++) - { - if (!key_exists($i, $arrContentElems)) - { - continue; - } - - if ($arrContentElems[$i]['sh5_tag'] == 'start') - { - $intCountToEnd = 0; - foreach ($arrRemainContentElems AS $key => $arrContentElem) - { - if ($arrContentElem == $arrContentElems[$i]) - { - continue; - } - - if ($arrContentElem['sh5_tag'] == 'start') - { - $intCountToEnd += 1; - continue; - } - else - { - if ($intCountToEnd == 0) - { - $arrSets[$pid][$arrContentElems[$i][id]]['sh5_pid'] = $arrContentElems[$i][id]; - unset($arrRemainContentElems[$i]); - - $arrSets[$pid][$arrContentElem['id']]['sh5_pid'] = $arrContentElems[$i][id]; - unset($arrRemainContentElems[$key]); - break; - } - else - { - $intCountToEnd -= 1; - } - } - } - - if (is_array($arrRemainContentElems[$i])) - { - $arrNoEndTag[] = $arrRemainContentElems[$i]; - unset($arrRemainContentElems[$i]); - } - } - } - - $arrErrorLogs = array_merge($arrRemainContentElems, $arrNoEndTag); - - if (count($arrErrorLogs) > 0) - { - foreach ($arrErrorLogs AS $key => $arrContentElem) - { - if (!$this->booDebug) - { - $this->log( - sprintf( - $GLOBALS['TL_LANG']['SH5']['runonce_update_error_text'], $arrContentElem['id'], $arrContentElem['pid'] - ), __CLASS__ . '::' . __FUNCTION__, $GLOBALS['TL_LANG']['SH5']['runonce_update_error_action'] - ); - } - else - { - var_dump( - sprintf( - $GLOBALS['TL_LANG']['SH5']['runonce_update_error_text'], $arrContentElem['id'], $arrContentElem['pid'] - ) - ); - } - } - } - } - - if ($this->booDebug) - { - echo "

UPDATE QUERYS

"; - } - - foreach ($arrSets AS $intPid => $arrSet) - { - foreach ($arrSet AS $intId => $intSh5Pid) - { - if (!$this->booDebug) - { - $this->Database - ->prepare("UPDATE tl_content %s WHERE id = ?") - ->set($intSh5Pid) - ->executeUncached($intId); - } - else - { - var_dump("UPDATE tl_content SET sh5_pid = " . $intSh5Pid['sh5_pid'] . " WHERE id = " . $intId); - } - } - } - - if ($this->booDebug) - { - $this->debug($arrArticleResult, $arrSets); - } - } - - public function debug($arrArticleResult, $arrSets) - { - echo "

ARRAYS

"; - foreach ($arrArticleResult AS $pid => $arrContentElem) - { - echo '

' . $pid . '

'; - var_dump($arrContentElem); - echo ''; - var_dump($arrSets[$pid]); - echo '
'; - echo '========================================================================================================================'; - } - exit(); - } - -} - -// Run once -$objRunonceJob = new RunonceSh5(); -$objRunonceJob->run(); -?> \ No newline at end of file