Exemplo n.º 1
0
 /**
  * Get list of root pages in current typo3
  *
  * @return  array
  */
 protected function _initLanguages()
 {
     $this->_languageIdList[0] = 0;
     $query = 'SELECT uid
                 FROM sys_language
                WHERE hidden = 0';
     $this->_languageIdList = DatabaseUtility::getColWithIndex($query);
 }
Exemplo n.º 2
0
 /**
  * Clear outdated and invalid pages from sitemap table
  */
 public static function expire()
 {
     // #####################
     // Expired pages
     // #####################
     $expireDays = (int) \Metaseo\Metaseo\Utility\GeneralUtility::getExtConf('sitemap_pageSitemapExpireDays', 60);
     if (empty($expireDays)) {
         $expireDays = 60;
     }
     // No negative days allowed
     $expireDays = abs($expireDays);
     $tstamp = time() - $expireDays * 24 * 60 * 60;
     $query = 'DELETE FROM tx_metaseo_sitemap
                     WHERE tstamp <= ' . (int) $tstamp . '
                       AND is_blacklisted = 0';
     DatabaseUtility::exec($query);
     // #####################
     //  Deleted or
     // excluded pages
     // #####################
     $query = 'SELECT
                     ts.uid
                 FROM
                     tx_metaseo_sitemap ts
                     LEFT JOIN pages p
                         ON p.uid = ts.page_uid
                        AND p.deleted = 0
                        AND p.hidden = 0
                        AND p.tx_metaseo_is_exclude = 0
                 WHERE
                     p.uid IS NULL';
     $deletedSitemapPages = DatabaseUtility::getColWithIndex($query);
     // delete pages
     if (!empty($deletedSitemapPages)) {
         $query = 'DELETE FROM tx_metaseo_sitemap
                         WHERE uid IN (' . implode(',', $deletedSitemapPages) . ')
                           AND is_blacklisted = 0';
         DatabaseUtility::exec($query);
     }
 }