Version 4.1.19

This commit is contained in:
Neo committed 2025-12-19 05:38:56 -08:00
1 parent 28bd025b35
commit 2bd5025018
2674 files changed
+233518 -77766

No files matched your search

+26 -16
View File
@@ -2,9 +2,9 @@
/**
* @brief Sitemap generator Class
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 29 Aug 2013
* @version SVN_VERSION_NUMBER
*/
@@ -23,7 +23,10 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
*/
class _Sitemap
{
const MAX_PER_FILE = 1500;
/**
* @brief Maximum number of entries to include per file
*/
const MAX_PER_FILE = 500;
/**
* @brief Count options
@@ -78,7 +81,7 @@ class _Sitemap
$sitemapsNotBuilt = array_diff( $files, iterator_to_array( \IPS\Db::i()->select( 'sitemap', 'core_sitemap' ) ) );
if ( count( $sitemapsNotBuilt ) )
{
$toBuild = array_pop( $sitemapsNotBuilt );
$toBuild = array_shift( $sitemapsNotBuilt );
}
else
{
@@ -111,9 +114,10 @@ class _Sitemap
*
* @param string $filename Filename
* @param array $entries The entries to add. Each entry should be an array with at least the key 'url'. Optional keys 'lastmod', 'priority' and 'changefreq' are also supported.
* @param int $lastId The last ID we built. This is used for content items to allow us to more efficiently fetch the next batch of items to build.
* @return void
*/
public function buildSitemapFile( $filename, $entries )
public function buildSitemapFile( $filename, $entries, $lastId=0 )
{
/* Start XML Document, set encoding, and create the namespaced index element */
$xmlWriter = new \XMLWriter();
@@ -156,17 +160,23 @@ class _Sitemap
$xmlWriter->endElement();
}
}
/* End the XML document */
$xmlWriter->endElement();
$xmlWriter->endDocument();
/* End the XML document */
$xmlWriter->endElement();
$xmlWriter->endDocument();
$content = $xmlWriter->outputMemory( TRUE );
}
else
{
$content = NULL;
}
/* Store */
\IPS\Db::i()->replace( 'core_sitemap', array(
'sitemap' => $filename,
'data' => $xmlWriter->outputMemory( TRUE ),
'updated' => time()
'data' => $content,
'updated' => time(),
'last_id' => $lastId
) );
}
@@ -184,6 +194,11 @@ class _Sitemap
$this->log[] = 'sitemap_ping_already24';
return;
}
/* Update last ping time before the requests are made so if they time out, it won't attempt to try again for 24 hrs */
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => time() ), array( 'conf_key=?', 'sitemap_last_ping' ) );
\IPS\Settings::i()->sitemap_last_ping = time();
unset( \IPS\Data\Store::i()->settings );
/* Ping Google */
$response = \IPS\Http\Url::external( "http://www.google.com/webmasters/tools/ping?sitemap=" . urlencode( $this->sitemapUrl ) )->request()->get();
@@ -207,10 +222,5 @@ class _Sitemap
{
$this->log[] = 'sitemap_ping_bing_success';
}
/* Update last ping time */
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => time() ), array( 'conf_key=?', 'sitemap_last_ping' ) );
\IPS\Settings::i()->sitemap_last_ping = time();
unset( \IPS\Data\Store::i()->settings );
}
}