| Server IP : 172.67.178.83 / Your IP : 216.73.217.141 Web Server : Apache System : Linux hosting01.arsenalhost.com 4.18.0-425.13.1.lve.el8.x86_64 #1 SMP Mon Feb 27 15:23:24 EST 2023 x86_64 User : corbizre ( 1013) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/corbizre/gotofindhomes.com3/components/Site/Controllers/ |
Upload File : |
<?php
/**
* Documentation
* @author
* @category
* @package
* @subpackage
* @copyright Copyright (c) 2005-2009 ITCrimea Ukraine Inc. (http://www.itcrimea.com)
* @license
*/
class Site_MapController extends System_Controller_Db_Table
{
/**
* Функция добавления ссылки в модуль для последующе генерации. Принимает параметры: URL, Freq, Priority.
* @author norbis
* @return void
*/
function addAction()
{
$paramURL = (string)$this->getRequest()->getParam('URL');
$paramFreq = (string)$this->getRequest()->getParam('Freq');
$paramPriority = (string)$this->getRequest()->getParam('Priority');
$this->_select->where('URL = ?', $paramURL);
$objectSitemap = $this->_model->fetchRow($this->_select);
if (!is_object($objectSitemap)){
$objectSitemap = $this->_model->fetchNew();
$objectSitemap->URL = $paramURL;
$objectSitemap->Freq = $paramFreq;
$objectSitemap->Priority = $paramPriority;
$objectSitemap->save();
}
$this->_helper->viewRenderer->setNoRender(true);
}
/**
* Функция пинка всех модулей добавится в компоненту :)
* @author norbis
* @return void
*/
public function initAction()
{
ini_set('max_execution_time', 36000);
$this->_helper->viewRenderer->setNoRender(true);
$configComponents = System_Components::getInstance()->getConfig();
$arrayComponents = $configComponents->Components->toArray();
$this->_helper->actionStack('clean', 'cache', 'site', array());
foreach ($arrayComponents as $configComponent){
$this->_helper->actionStack('addsitemap', 'index', $configComponent['Name'], array());
}
$this->addOkMessage('Sitemap successfully initialized');
}
/**
* Функция создания файлов sitemap
* @author norbis
* @return void
*/
public function createAction()
{
ini_set('max_execution_time', 3600);
$intCountAll = $this->_model->fetchRow($this->_selectCount)->count;
$intFiles = ceil($intCountAll / 45000);
$strAppFolder = Zend_Registry::get('AppFolder');
file_put_contents($strAppFolder . '/sitemap.xml', '<?xml version="1.0" encoding="UTF-8"?>'."\n", FILE_APPEND);
file_put_contents($strAppFolder . '/sitemap.xml', '<sitemapindex xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd"
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n", FILE_APPEND);
for ($I = 1; $I <= $intFiles; $I ++){
file_put_contents($strAppFolder . '/sitemap.xml', '<sitemap><loc>http://'. $_SERVER['HTTP_HOST']. '/sitemap' . $I . '.xml'. '</loc><lastmod>' . date('Y-m-d') . '</lastmod></sitemap>'."\n", FILE_APPEND);
}
file_put_contents($strAppFolder . '/sitemap.xml', '</sitemapindex>'."\n", FILE_APPEND);
for ($I = 1; $I <= $intFiles; $I ++){
$this->_select->order('Priority');
$this->_select->limit(45000, ($I-1) * 45000 );
$listSiteMap = $this->_model->fetchAll($this->_select);
file_put_contents($strAppFolder . '/sitemap' . $I . '.xml', '<?xml version="1.0" encoding="UTF-8"?>', FILE_APPEND);
file_put_contents($strAppFolder . '/sitemap' . $I . '.xml', '<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'."\n", FILE_APPEND);
foreach ($listSiteMap as $objectSiteMap){
file_put_contents($strAppFolder . '/sitemap' . $I . '.xml',
'<url><loc>' . $objectSiteMap->URL . '</loc><lastmod>' . date('Y-m-d') . '</lastmod><changefreq>'
. $objectSiteMap->Freq . '</changefreq><priority>' . $objectSiteMap->Priority . '</priority></url>'."\n",
FILE_APPEND);
}
file_put_contents($strAppFolder . '/sitemap' . $I . '.xml', '</urlset>'."\n", FILE_APPEND);
}
$this->_helper->viewRenderer->setNoRender(true);
}
}