Patch for updating the contentLength property of all images to fix wrong values caused by issue 93.
This commit is contained in:
parent
eab69cd022
commit
9e2ead5772
2 changed files with 42 additions and 0 deletions
1
.gitattributes
vendored
1
.gitattributes
vendored
|
@ -201,6 +201,7 @@ extra/apps.properties svneol=native#text/plain
|
||||||
extra/jetty.xml svneol=native#text/plain
|
extra/jetty.xml svneol=native#text/plain
|
||||||
extra/mrtg.cfg -text
|
extra/mrtg.cfg -text
|
||||||
extra/updater/patch-20080913.js -text
|
extra/updater/patch-20080913.js -text
|
||||||
|
extra/updater/patch-20100401.js svneol=native#text/plain
|
||||||
i18n/antville.pot -text
|
i18n/antville.pot -text
|
||||||
i18n/de.po -text
|
i18n/de.po -text
|
||||||
i18n/en.po -text
|
i18n/en.po -text
|
||||||
|
|
41
extra/updater/patch-20100401.js
Normal file
41
extra/updater/patch-20100401.js
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
//
|
||||||
|
// The Antville Project
|
||||||
|
// http://code.google.com/p/antville
|
||||||
|
//
|
||||||
|
// Copyright 2001-2010 by The Antville People
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the ``License'');
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an ``AS IS'' BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
//
|
||||||
|
// $Revision$
|
||||||
|
// $LastChangedBy$
|
||||||
|
// $LastChangedDate$
|
||||||
|
// $URL$
|
||||||
|
//
|
||||||
|
|
||||||
|
// Needs to be applied from within antville code (does not work inside updater)
|
||||||
|
|
||||||
|
global["patch-20100401"] = function() {
|
||||||
|
var sql = new Sql;
|
||||||
|
sql.retrieve("select id from image");
|
||||||
|
sql.traverse(function() {
|
||||||
|
var image = Image.getById(this.id);
|
||||||
|
try {
|
||||||
|
var contentLength = image.getFile().getLength();
|
||||||
|
if (contentLength && image.contentLength !== contentLength) {
|
||||||
|
res.debug(image._id + "/" + image.name + ": " +
|
||||||
|
image.contentLength + "/" + contentLength);
|
||||||
|
image.contentLength = contentLength;
|
||||||
|
}
|
||||||
|
} catch (x) { }
|
||||||
|
});
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue