[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
www/server/source source.html update-license.ph...
From: |
James Turner |
Subject: |
www/server/source source.html update-license.ph... |
Date: |
Thu, 14 Jul 2011 15:52:07 +0000 |
CVSROOT: /web/www
Module name: www
Changes by: James Turner <jturner> 11/07/14 15:52:07
Modified files:
server/source : source.html
Added files:
server/source : update-license.php.txt
Log message:
Add the php script I wrote to update the license text.
CVSWeb URLs:
http://web.cvs.savannah.gnu.org/viewcvs/www/server/source/source.html?cvsroot=www&r1=1.32&r2=1.33
http://web.cvs.savannah.gnu.org/viewcvs/www/server/source/update-license.php.txt?cvsroot=www&rev=1.1
Patches:
Index: source.html
===================================================================
RCS file: /web/www/www/server/source/source.html,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- source.html 13 Jul 2011 17:31:55 -0000 1.32
+++ source.html 14 Jul 2011 15:52:04 -0000 1.33
@@ -166,10 +166,20 @@
<li>Author: <a href="mailto:address@hidden">Shailesh Ghadge</a></li>
</ul>
-<p>This perl scripts fetches & saves 'n' feeds from planet.gnu.org using RSS
+<p>This perl scripts fetches & saves 'n' feeds from planet.gnu.org using
RSS
feed link http://planet.gnu.org/rss20.xml in html format where it is then
included in the homepage. Each feed is truncated to 'm' characters.</p>
+<h3><a id="update-license">update-license.php</a></h3>
+
+<ul>
+ <li><a href="/server/source/update-license.php.txt">Source code</a></li>
+ <li>Author: <a href="mailto:address@hidden">James Turner</a></li>
+</ul>
+
+<p>This script can be ran from the webroot to traverse through english html
+files replacing the old "Verbatim coping" text with the new CC license.</p>
+
<!-- If needed, change the copyright block at the bottom. In general,
all pages on the GNU web server should have the section about
verbatim copying. Please do NOT remove this without talking
@@ -201,7 +211,7 @@
<p>Updated:
<!-- timestamp start -->
-$Date: 2011/07/13 17:31:55 $
+$Date: 2011/07/14 15:52:04 $
<!-- timestamp end --></p>
</div>
Index: update-license.php.txt
===================================================================
RCS file: update-license.php.txt
diff -N update-license.php.txt
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ update-license.php.txt 14 Jul 2011 15:52:04 -0000 1.1
@@ -0,0 +1,103 @@
+<?php
+
+/*
+ * Copyright (c) 2011 James Turner <address@hidden>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+$dirIterator = new RecursiveDirectoryIterator('.');
+$iterator = new RecursiveIteratorIterator($dirIterator,
RecursiveIteratorIterator::SELF_FIRST);
+
+foreach ($iterator as $file) {
+ // ignore special certain files
+ $ignores = array(
+ './prep/ftp.html',
+ './graphics/jesus-cartoon.html',
+ './licenses/dsl.html',
+ './licenses/old-licenses/fdl-1.2.html',
+ './licenses/old-licenses/gpl-2.0.html',
+ './licenses/agpl-3.0.html',
+ './licenses/fdl-1.3.html',
+ './licenses/gpl-3.0.html',
+ './licenses/lgpl-3.0.html',
+ './licenses/autoconf-exception-3.0.html',
+ './licenses/gcc-exception-3.0.html',
+ './licenses/gcc-exception-3.1.html',
+ './philosophy/copyright-versus-community-2000.html',
+ './philosophy/enforcing-gpl.html',
+ './philosophy/freedom-or-power.html',
+ './philosophy/gpl-american-dream.html',
+ './philosophy/moglen-harvard-speech-2004.html',
+ './philosophy/nit-india.html',
+ './philosophy/nonsoftware-copyleft.html',
+ './philosophy/patent-practice-panel.html',
+ './philosophy/self-interest.html',
+ './philosophy/software-libre-commercial-viability.html',
+ './philosophy/vaccination.html',
+ './philosophy/why-audio-format-matters.html',
+ './philosophy/sco/questioning-sco.html',
+ './philosophy/sco/sco-preemption.html',
+ './philosophy/sco/sco-without-fear.html',
+ './press/2001-06-28-USENIX.html',
+ );
+
+ if (in_array($file, $ignores)) {
+ continue;
+ }
+
+ // ignore everything under software except at the root level
+ if (substr($file, 0, 10) == './software') {
+ if (!preg_match('#^./software/[a-zA-Z0-9-]+\.html$#', $file)) {
+ continue;
+ }
+ }
+
+ // ignore everything that's not an html file
+ if (substr($file, -5) != '.html') {
+ continue;
+ }
+
+ // ignore full translation directories
+ if (preg_match('/wwwes|wwwin/', $file)) {
+ continue;
+ }
+
+ // ignore all translation html files
+ if (preg_match('/\.[a-zA-Z-]+\.html/', $file)) {
+ continue;
+ }
+
+ $contents = file_get_contents($file);
+
+ if (strpos($contents, 'Verbatim copying') === false &&
+ strpos($contents, 'Permission is granted to anyone to make or
distribute verbatim copies of') === false) {
+ continue;
+ }
+
+ $replace = <<<END
+This page is licensed under a <a rel="license"
+href="http://creativecommons.org/licenses/by-nd/3.0/us/">Creative
+Commons Attribution-NoDerivs 3.0 United States License</a>.
+$2
+END;
+
+ $pattern = '#(Verbatim copying.*)(</p>|</P>|<p>|<P>|<HR>)#Us';
+ $contents = preg_replace($pattern, $replace, $contents);
+
+ $pattern = '#(Permission is granted to anyone to make or distribute
verbatim copies of.*)(</p>|</P>|<p>|<P>|<HR>|</BLOCKQUOTE>)#Us';
+ $contents = preg_replace($pattern, $replace, $contents);
+
+ file_put_contents($file, $contents);
+}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- www/server/source source.html update-license.ph...,
James Turner <=