Bug 16016

Summary: Integrate sitemap.pl into the packages
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: PackagingAssignee: Tomás Cohen Arazi (tcohen) <tomascohen>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: f.demians, kyle, mirko, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: Sponsored Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 11190    
Bug Blocks:    
Attachments: Bug 16016: Sitemap handling scripts for packages
Bug 16016: Apache file tweak
Bug 16016: (followup) let the package know about koha-sitemap
Bug 16016: Sitemap handling scripts for packages
Bug 16016: Sitemap handling scripts for packages

Description Tomás Cohen Arazi (tcohen) 2016-03-09 12:47:04 UTC
The sitemap generating tool needs to be integrated into the packages so users can take advantage of it. Steps to do it:

- Write koha-sitemap wrapper script that handles multiple instances and sets directories and files in a kosher place.
- Integrate it into Apache
Comment 1 Tomás Cohen Arazi (tcohen) 2016-03-09 13:35:10 UTC Comment hidden (obsolete)
Comment 2 Tomás Cohen Arazi (tcohen) 2016-03-09 13:35:19 UTC Comment hidden (obsolete)
Comment 3 Tomás Cohen Arazi (tcohen) 2016-03-16 03:09:35 UTC Comment hidden (obsolete)
Comment 4 Frédéric Demians 2016-04-21 11:54:26 UTC Comment hidden (obsolete)
Comment 5 Kyle M Hall (khall) 2016-04-27 16:28:56 UTC
Created attachment 50831 [details] [review]
Bug 16016: Sitemap handling scripts for packages

This patch introduces the koha-sitemap script. This script wraps calls to
the misc/cronjobs/sitemap.pl script so it can be done easily instance-wise.

It sets /var/lib/koha/${instance}/sitemap as the destination directory for
the sitemap files. A followup will make them available through an Apache
configuration entry.

koha-functions.sh is provided with a handy is_sitemap_enabled function so
we can later add filters to other commands (koha-list, koha-foreach, etc).

Exposes sitemap files to apache. This is suitable for including the sitemap in
the robots.txt file as proposed in

  http://www.sitemaps.org/protocol.html#submit_robots

Note: it depends on Apache 2.4+ so we can patch the file as needed. Older
Apache users will be warned that they need to tweak the apache files on their
own.

To test:
- You can build a package out of this patchset, or do the following on a kohadevbox
  cp debian/scripts/koha-functions.sh /usr/share/koha/bin
- Run
  $ debian/scripts/koha-sitemap --help
- Go through all the options (--enable, --disable, generate).
(a) --enable:
  - debian/scripts/koha-sitemap --enable kohadev
=> SUCCESS: /var/lib/koha/kohadev/sitemap.enabled is created
  - call it again, a suitable warning is raised and the file is still there
(b) debian/scripts/koha-sitemap --disable kohadev
=> SUCCESS: /var/lib/koha/kohadev/sitemap.enabled is deleted
  - call it again, a suitable warning is raised and the file does not exist
(c) --generate:
  - debian/scripts/koha-sitemap --generate kohadev
=> SUCCESS: sitemapindex.xml and sitemap000X.xml files are generated in
            /var/lib/koha/kohadev/sitemap/
- Sign off :-D

Sponsored-by: Orex Digital
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 6 Mirko Tietgen 2016-04-27 16:44:40 UTC
Kyle beat me to it. One thing i saw:

> if /usr/sbin/apache2ctl -v | grep -q -v "Server version: Apache/2.4"; then

I guess that will break it for Apache > 2.4?
Comment 7 Tomás Cohen Arazi (tcohen) 2016-04-27 18:54:02 UTC
(In reply to Mirko Tietgen from comment #6)
> Kyle beat me to it. One thing i saw:
> 
> > if /usr/sbin/apache2ctl -v | grep -q -v "Server version: Apache/2.4"; then
> 
> I guess that will break it for Apache > 2.4?

I'll fix it once new Apaches are born.
Comment 8 Kyle M Hall (khall) 2016-05-04 13:34:47 UTC
Pushed to master for Koha 16.05, thanks Tomas!