Skip to content
Permalink
Browse files

INIT: Initial commit ready for GitHub.

  • Loading branch information...
Russell Michell
Russell Michell committed May 6, 2015
1 parent a68f74f commit 293554b5056dc0960912c0d52c67b5b7744fb0a1
Showing with 59 additions and 19 deletions.
  1. +27 −0 LICENCE
  2. +4 −0 README.md
  3. +1 −6 _config.php
  4. +1 −1 _config/googlesitemapautoupdate.yml
  5. +16 −9 code/extensions/{SitemapUpdator.php → SitemapUpdater.php}
  6. +10 −3 composer.json
27 LICENCE
@@ -0,0 +1,27 @@
Copyright (c) 2014-2015, Deviate Ltd - www.deviate.net.nz
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

* Neither the name of Deviate Ltd nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,4 @@
# SilverStripe Google Sitemap Auto Update

The module goes over and above other similar modules by auto-updating the sitemap.xml
each time an object is published.
@@ -1,6 +1 @@
<?php
/**
* Author: Normann
* Date: 7/08/14
* Time: 2:56 PM
*/
<?php
@@ -7,4 +7,4 @@ After:
---
SiteTree:
extensions:
- SitemapUpdator
- SitemapUpdater
@@ -1,11 +1,16 @@
<?php
/**
* Author: Normann
* Date: 7/08/14
* Time: 1:45 PM
*
* @author Deviate Ltd 2015 http://www.deviate.net.nz
* @package silverstripe-googlesitemapautoupdate
*/
class SitemapUpdator extends SiteTreeExtension {
class SitemapUpdater extends SiteTreeExtension {
/**
*
* @param type $original
* @return mixed void | null
*/
public function onAfterPublish(&$original) {
$list = QueuedJobDescriptor::get()->filter(array(
'JobStatus' => array(QueuedJob::STATUS_INIT, QueuedJob::STATUS_RUN), //Initialising and Running
@@ -30,8 +35,8 @@ public function onAfterPublish(&$original) {
return;
}
// if no such a job existing, create a new one for the first time, and run immediately
//first remove all the legacy job which might be in these status:
// If no such a job existing, create a new one for the first time, and run immediately
// But first remove all legacy jobs which might be of the following statuses:
/**
* New (but Start data somehow is less than now)
* Waiting
@@ -43,10 +48,12 @@ public function onAfterPublish(&$original) {
$list = QueuedJobDescriptor::get()->filter(array(
'Implementation'=> 'GenerateGoogleSitemapJob',
));
if($list && $list->count()) $list->removeAll();
if($list && $list->count()) {
$list->removeAll();
}
$job = new GenerateGoogleSitemapJob();
singleton('QueuedJobService')->queueJob($job);
}
}
}
}
@@ -1,11 +1,18 @@
{
"name": "normann.lou/google-sitemap-autoupdate",
"description": "a module that create a sitemap.xml and update it automatically once a page published",
"name": "deviateltd/silverstripe-googlesitemapautoupdate",
"description": "Creates a Google sitemap.xml and auto-updates it whenever a page published.",
"type": "silverstripe-module",
"keywords": ["sitemap", "google", "auto", "update"],
"authors": [
{
"name": "Normann Lou",
"email": "normann.lou@deviate.net.nz"
}
],
"require": {
"composer/installers": "*",
"silverstripe/cms": ">=3.1",
"silverstripe/framework": ">=3.1",
"silverstripe/queuedjobs": ">=2.1.0"
"silverstripe/queuedjobs": ">=2.3.1"
}
}

0 comments on commit 293554b

Please sign in to comment.
You can’t perform that action at this time.