Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Perez committed Jul 21, 2017
1 parent de8b5b2 commit e0fdc66
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
7 changes: 1 addition & 6 deletions SitemapBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@ class SitemapBuilder extends Object
/** @var array List of xml-files for sitemap index */
private $_filesList = [];

private $baseUrl = null;

public function __construct()
{
$this->baseUrl = $this->baseUrl ? $this->baseUrl : Yii::$app->urlManager->baseUrl;
}
public $baseUrl = null;

public function writeHeader()
{
Expand Down
4 changes: 2 additions & 2 deletions SitemapController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ class SitemapController extends Controller
public $sitemapFileName = 'sitemap.xml';
/** @var array Default config for sitemap builder */
public $builderConfig = [
'urlsPerFile' => 10000,
'urlsPerFile' => 100,
];
/** @var string Base Url for sitemap links. As webroot: "http://example.com" */
public $baseUrl = null;
public $baseUrl;

/**
* @inheritdoc
Expand Down
5 changes: 3 additions & 2 deletions SitemapDataHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class SitemapDataHandler extends Object
protected static $_appLanguage;

/** @var String baseUrl */
private $baseUrl = null;
private $baseUrl;

public function __construct($savePathAlias, $sitemapFileName, $baseUrl, $config = [])
{
Expand Down Expand Up @@ -158,6 +158,7 @@ public function handleModel(Basic $model, $lang = null)

// Search models in db
$query = $model->getSitemapItemsQuery($lang);

if ($query instanceof \yii\db\Query) {
// Foreach batch models
$batchSize = static::getModelBatchSize($model);
Expand Down Expand Up @@ -254,7 +255,7 @@ public function getBuilder()
'savePathAlias' => $this->savePathAlias,
'sitemapFileName' => $this->sitemapFileName,
'schemas' => $this->_schemas,
'baseUrl' => $this->baseUrl,
'baseUrl' => $this->baseUrl ? $this->baseUrl : Yii::$app->urlManager->baseUrl,
], $this->builderConfig);

$this->_builder = Yii::createObject($config);
Expand Down

0 comments on commit e0fdc66

Please sign in to comment.