#62 : Clean old files
This commit is contained in:
parent
e0529485b7
commit
6c9d5a5c21
|
@ -1,4 +0,0 @@
|
|||
@set PHPINSTALLDIR=C:\php\5.2.9\;C:\php5;C:\LAMP\php;C:\LAMP\php5;D:\LAMP\php5
|
||||
@set PATH=%PHPINSTALLDIR%;%PATH%;
|
||||
cls
|
||||
php build.php
|
|
@ -1,336 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2010 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
/**
|
||||
* This file creates a build of PHPExcel
|
||||
*/
|
||||
|
||||
// Build parameters
|
||||
$sVersion = "";
|
||||
$sDate = "";
|
||||
|
||||
// Read build parameters from STDIN
|
||||
$stdin = fopen("php://stdin", 'r');
|
||||
echo "PHPExcel build script\n";
|
||||
echo "---------------------\n";
|
||||
echo "Enter the version number you want to add to the build:\t\t\t";
|
||||
$sVersion = rtrim(fread($stdin, 1024));
|
||||
|
||||
echo "Enter the date number you want to add to the build: (YYYY-MM-DD)\t";
|
||||
$sDate = rtrim(fread($stdin, 1024));
|
||||
|
||||
echo "\n\n";
|
||||
|
||||
// Specify paths and files to include
|
||||
$aFilesToInclude = array('../changelog.txt', '../install.txt', '../license.txt');
|
||||
$aPathsToInclude = array('../Classes', '../Tests', '../Documentation');
|
||||
$aIgnorePatterns = array('/\.svn/i', '/\.settings/i', '/\.project/i', '/\.projectOptions/i', '/\.cache/i', '/assets/i');
|
||||
$sClassPath = '../Classes';
|
||||
$sPEARPath = 'C:\php\5.2.9\pear';
|
||||
$sAPIDocumentation = '../Documentation/API/';
|
||||
|
||||
// Create API documentation folder and tell to create documentation
|
||||
@mkdir($sAPIDocumentation);
|
||||
echo "Please, generate API documentation using phpDocumentor.\r\n";
|
||||
|
||||
$finished = '';
|
||||
while (strtolower($finished) != 'y') {
|
||||
$finished = '';
|
||||
echo "Has documentation generation finished? (y/n)\t";
|
||||
$finished = rtrim(fread($stdin, 1024));
|
||||
}
|
||||
|
||||
echo "\n\n\n";
|
||||
|
||||
// Resulting file
|
||||
$strResultingFile = $sVersion . '.zip';
|
||||
|
||||
// Starting build
|
||||
echo date('H:i:s') . " Starting build...\n";
|
||||
|
||||
// Create new ZIP file and open it for writing
|
||||
echo date('H:i:s') . " Creating ZIP archive...\n";
|
||||
$objZip = new ZipArchive();
|
||||
|
||||
// Try opening the ZIP file
|
||||
if ($objZip->open($strResultingFile, ZIPARCHIVE::OVERWRITE) !== true) {
|
||||
throw new Exeption("Could not open " . $strResultingFile . " for writing!");
|
||||
}
|
||||
|
||||
// Add files to include
|
||||
foreach ($aFilesToInclude as $strFile) {
|
||||
echo date('H:i:s') . " Adding file $strFile\n";
|
||||
addFileToZIP($strFile, $objZip, $sVersion, $sDate);
|
||||
}
|
||||
|
||||
// Add paths to include
|
||||
foreach ($aPathsToInclude as $strPath) {
|
||||
addPathToZIP($strPath, $objZip, $sVersion, $sDate);
|
||||
}
|
||||
|
||||
// Set archive comment...
|
||||
echo date('H:i:s') . " Set archive comment...\n";
|
||||
$objZip->setArchiveComment('PHPExcel - http://www.codeplex.com/PHPExcel');
|
||||
|
||||
// Close file
|
||||
echo date('H:i:s') . " Saving ZIP archive...\n";
|
||||
$objZip->close();
|
||||
|
||||
// Copy classes directory
|
||||
echo date('H:i:s') . " Copying class directory...\n";
|
||||
mkdir('./tmp');
|
||||
dircopy($sClassPath, './tmp');
|
||||
|
||||
// Create PEAR package.xml
|
||||
echo date('H:i:s') . " Creating PEAR package.xml...\n";
|
||||
$packageFile = file_get_contents('package.xml');
|
||||
$packageFile = replaceMetaData($packageFile, $sVersion, $sDate);
|
||||
|
||||
$packageFile = str_replace('##PEAR_DIR##', addPathToPEAR('./tmp', '', $sVersion, $sDate), $packageFile);
|
||||
$fh = fopen('./tmp/package.xml', 'w');
|
||||
fwrite($fh, $packageFile);
|
||||
fclose($fh);
|
||||
|
||||
// Create PEAR package
|
||||
echo date('H:i:s') . " Creating PEAR package...\n";
|
||||
echo shell_exec("$sPEARPath package ./tmp/package.xml");
|
||||
|
||||
// Wait a minute (TortoiseSVN on USB stick is slow!)
|
||||
echo date('H:i:s') . " Waiting...\n";
|
||||
sleep(120);
|
||||
|
||||
// Clean temporary files
|
||||
echo date('H:i:s') . " Cleaning temporary files...\n";
|
||||
unlink('./tmp/package.xml');
|
||||
rm('./tmp');
|
||||
|
||||
// Finished build
|
||||
echo date('H:i:s') . " Finished build!\n";
|
||||
fclose($stdin);
|
||||
|
||||
/**
|
||||
* Add a specific path's files and folders to a ZIP object
|
||||
*
|
||||
* @param string $strPath Path to add
|
||||
* @param ZipArchive $objZip ZipArchive object
|
||||
* @param string $strVersion Version string
|
||||
* @param string $strDate Date string
|
||||
*/
|
||||
function addPathToZIP($strPath, $objZip, $strVersion, $strDate) {
|
||||
global $aIgnorePatterns;
|
||||
|
||||
echo date('H:i:s') . " Adding path $strPath...\n";
|
||||
|
||||
$currentDir = opendir($strPath);
|
||||
while ($strFile = readdir($currentDir)) {
|
||||
if ($strFile != '.' && $strFile != '..') {
|
||||
if (is_file($strPath . '/' . $strFile)) {
|
||||
addFileToZIP($strPath . '/' . $strFile, $objZip, $strVersion, $strDate);
|
||||
} else if (is_dir($strPath . '/' . $strFile)) {
|
||||
if (!shouldIgnore($strFile)) {
|
||||
addPathToZIP( ($strPath . '/' . $strFile), $objZip, $strVersion, $strDate );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a specific file to ZIP
|
||||
*
|
||||
* @param string $strFile File to add
|
||||
* @param ZipArchive $objZip ZipArchive object
|
||||
* @param string $strVersion Version string
|
||||
* @param string $strDate Date string
|
||||
*/
|
||||
function addFileToZIP($strFile, $objZip, $strVersion, $strDate) {
|
||||
if (!shouldIgnore($strFile)) {
|
||||
$fileContents = file_get_contents($strFile);
|
||||
$fileContents = replaceMetaData($fileContents, $strVersion, $strDate);
|
||||
|
||||
//$objZip->addFile($strFile, cleanFileName($strFile));
|
||||
$objZip->addFromString( cleanFileName($strFile), $fileContents );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleanup a filename
|
||||
*
|
||||
* @param string $strFile Filename
|
||||
* @return string Filename
|
||||
*/
|
||||
function cleanFileName($strFile) {
|
||||
$strFile = str_replace('../', '', $strFile);
|
||||
$strFile = str_replace('WINDOWS', '', $strFile);
|
||||
|
||||
while (preg_match('/\/\//i', $strFile)) {
|
||||
$strFile = str_replace('//', '/', $strFile);
|
||||
}
|
||||
|
||||
return $strFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace metadata in string
|
||||
*
|
||||
* @param string $strString String contents
|
||||
* @param string $strVersion Version string
|
||||
* @param string $strDate Date string
|
||||
* @return string String contents
|
||||
*/
|
||||
function replaceMetaData($strString, $strVersion, $strDate) {
|
||||
$strString = str_replace('##VERSION##', $strVersion, $strString);
|
||||
$strString = str_replace('##DATE##', $strDate, $strString);
|
||||
return $strString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a specific path's files and folders to a PEAR dir list
|
||||
*
|
||||
* @param string $strPath Path to add
|
||||
* @param string $strPEAR String containing PEAR dir definitions
|
||||
* @param string $strVersion Version string
|
||||
* @param string $strDate Date string
|
||||
* @return string String containing PEAR dir definitions
|
||||
*/
|
||||
function addPathToPEAR($strPath, $strPEAR, $strVersion, $strDate) {
|
||||
global $aIgnorePatterns;
|
||||
|
||||
$currentDir = opendir($strPath);
|
||||
while ($strFile = readdir($currentDir)) {
|
||||
if ($strFile != '.' && $strFile != '..') {
|
||||
if (is_file($strPath . '/' . $strFile) && !preg_match('/package.xml/i', $strFile)) {
|
||||
$strPEAR .= addFileToPEAR($strPath . '/' . $strFile, '', $strVersion, $strDate);
|
||||
} else if (is_dir($strPath . '/' . $strFile)) {
|
||||
if (!shouldIgnore($strFile)) {
|
||||
$strPEAR .= '<dir name="' . $strFile . '">';
|
||||
$strPEAR .= addPathToPEAR( ($strPath . '/' . $strFile), '', $strVersion, $strDate );
|
||||
$strPEAR .= '</dir>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $strPEAR;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a specific file to a PEAR dir list
|
||||
*
|
||||
* @param string $strFile File to add
|
||||
* @param string $strPEAR String containing PEAR dir definitions
|
||||
* @param string $strVersion Version string
|
||||
* @param string $strDate Date string
|
||||
* @return string String containing PEAR dir definitions
|
||||
*/
|
||||
function addFileToPEAR($strFile, $strPEAR, $strVersion, $strDate) {
|
||||
if (!shouldIgnore($strFile)) {
|
||||
$fileContents = file_get_contents($strFile);
|
||||
$fileContents = replaceMetaData($fileContents, $strVersion, $strDate);
|
||||
$fh = fopen($strFile, 'w');
|
||||
fwrite($fh, $fileContents);
|
||||
fclose($fh);
|
||||
|
||||
$strPEAR .= '<file name="' . basename($strFile) . '" role="php" />';
|
||||
|
||||
return $strPEAR;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy a complete directory
|
||||
*
|
||||
* @param string $srcdir Source directory
|
||||
* @param string $dstdir Destination directory
|
||||
* @return int Number of copied files
|
||||
*/
|
||||
function dircopy($srcdir, $dstdir, $verbose = false) {
|
||||
$num = 0;
|
||||
if(!is_dir($dstdir) && !shouldIgnore($dstdir)) mkdir($dstdir);
|
||||
if($curdir = opendir($srcdir)) {
|
||||
while($file = readdir($curdir)) {
|
||||
if($file != '.' && $file != '..') {
|
||||
$srcfile = $srcdir . '\\' . $file;
|
||||
$dstfile = $dstdir . '\\' . $file;
|
||||
if(is_file($srcfile) && !shouldIgnore($srcfile)) {
|
||||
if(is_file($dstfile)) $ow = filemtime($srcfile) - filemtime($dstfile); else $ow = 1;
|
||||
if($ow > 0) {
|
||||
if($verbose) echo "Copying '$srcfile' to '$dstfile'...";
|
||||
if(copy($srcfile, $dstfile)) {
|
||||
touch($dstfile, filemtime($srcfile)); $num++;
|
||||
if($verbose) echo "OK\n";
|
||||
}
|
||||
else echo "Error: File '$srcfile' could not be copied!\n";
|
||||
}
|
||||
}
|
||||
else if(is_dir($srcfile) && !shouldIgnore($srcfile)) {
|
||||
$num += dircopy($srcfile, $dstfile, $verbose);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($curdir);
|
||||
}
|
||||
return $num;
|
||||
}
|
||||
|
||||
/**
|
||||
* rm() -- Very Vigorously erase files and directories. Also hidden files !!!!
|
||||
*
|
||||
* @param $dir string
|
||||
* be carefull to:
|
||||
* if($obj=='.' || $obj=='..') continue;
|
||||
* if not it will erase all the server...it happened to me ;)
|
||||
* the function is permission dependent.
|
||||
*/
|
||||
function rm($dir) {
|
||||
if(!$dh = @opendir($dir)) return;
|
||||
while (($obj = readdir($dh))) {
|
||||
if($obj=='.' || $obj=='..') continue;
|
||||
@chmod($dir.'/'.$obj, 0777);
|
||||
if (!@unlink($dir.'/'.$obj)) rm($dir.'/'.$obj);
|
||||
}
|
||||
@rmdir($dir);
|
||||
@shell_exec('rmdir /S /Q "' . $dir . '"');
|
||||
}
|
||||
|
||||
/**
|
||||
* Should a file/folder be ignored?
|
||||
*
|
||||
* @param string $pName
|
||||
* @return boolean
|
||||
*/
|
||||
function shouldIgnore($pName = '') {
|
||||
global $aIgnorePatterns;
|
||||
|
||||
$ignore = false;
|
||||
foreach ($aIgnorePatterns as $ignorePattern) {
|
||||
if (preg_match($ignorePattern, $pName)) {
|
||||
$ignore = true;
|
||||
}
|
||||
}
|
||||
return $ignore;
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<package version="2.0" xmlns="http://pear.php.net/dtd/package-2.0"
|
||||
xmlns:tasks="http://pear.php.net/dtd/tasks-1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
|
||||
http://pear.php.net/dtd/tasks-1.0.xsd
|
||||
http://pear.php.net/dtd/package-2.0
|
||||
http://pear.php.net/dtd/package-2.0.xsd">
|
||||
<name>PHPExcel</name>
|
||||
<uri>http://www.codeplex.com/PHPExcel/PHPExcel-##VERSION##</uri>
|
||||
<summary>PHP Excel classes</summary>
|
||||
<description>
|
||||
Project providing a set of classes for the PHP programming language, which allow you to write to Excel 2007 files and read from Excel 2007 files.
|
||||
</description>
|
||||
<lead>
|
||||
<name>Maarten Balliauw</name>
|
||||
<user>maartenba</user>
|
||||
<email>maarten@phpexcel.net</email>
|
||||
<active>yes</active>
|
||||
</lead>
|
||||
<date>##DATE##</date>
|
||||
<version>
|
||||
<release>##VERSION##</release>
|
||||
<api>##VERSION##</api>
|
||||
</version>
|
||||
<stability>
|
||||
<release>stable</release>
|
||||
<api>stable</api>
|
||||
</stability>
|
||||
<license uri="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt">LGPL</license>
|
||||
<notes>This package ONLY contains the class files, not the documentation and example code. Please refer to http://www.codeplex.com/PHPExcel for those files.</notes>
|
||||
<contents>
|
||||
<dir name="/">
|
||||
##PEAR_DIR##
|
||||
</dir>
|
||||
</contents>
|
||||
<dependencies>
|
||||
<required>
|
||||
<php>
|
||||
<min>5.0</min>
|
||||
</php>
|
||||
<pearinstaller>
|
||||
<min>1.4.0</min>
|
||||
</pearinstaller>
|
||||
<extension>
|
||||
<name>zip</name>
|
||||
</extension>
|
||||
</required>
|
||||
</dependencies>
|
||||
<phprelease>
|
||||
<filelist>
|
||||
</filelist>
|
||||
</phprelease>
|
||||
</package>
|
36
README.md
36
README.md
|
@ -1,36 +0,0 @@
|
|||
# PHPExcel - OpenXML - Read, Write and Create spreadsheet documents in PHP - Spreadsheet engine
|
||||
PHPExcel is a library written in pure PHP and providing a set of classes that allow you to write to and read from different spreadsheet file formats, like Excel (BIFF) .xls, Excel 2007 (OfficeOpenXML) .xlsx, CSV, Libre/OpenOffice Calc .ods, Gnumeric, PDF, HTML, ... This project is built around Microsoft's OpenXML standard and PHP.
|
||||
|
||||
|
||||
## File Formats supported
|
||||
|
||||
### Reading
|
||||
* BIFF 5-8 (.xls) Excel 95 and above
|
||||
* Office Open XML (.xlsx) Excel 2007 and above
|
||||
* SpreadsheetML (.xml) Excel 2003
|
||||
* Open Document Format/OASIS (.ods)
|
||||
* Gnumeric
|
||||
* HTML
|
||||
* SYLK
|
||||
* CSV
|
||||
|
||||
### Writing
|
||||
* BIFF 8 (.xls) Excel 95 and above
|
||||
* Office Open XML (.xlsx) Excel 2007 and above
|
||||
* HTML
|
||||
* CSV
|
||||
* PDF (using either the tcPDF, DomPDF or mPDF libraries, which need to be installed separately)
|
||||
|
||||
|
||||
## Requirements
|
||||
* PHP version 5.2.0 or higher
|
||||
* PHP extension php_zip enabled (required if you need PHPExcel to handle .xlsx .ods or .gnumeric files)
|
||||
* PHP extension php_xml enabled
|
||||
* PHP extension php_gd2 enabled (optional, but required for exact column width autocalculation)
|
||||
|
||||
|
||||
## Want to contribute?
|
||||
Fork us!
|
||||
|
||||
## License
|
||||
PHPExcel is licensed under [LGPL (GNU LESSER GENERAL PUBLIC LICENSE)](https://github.com/PHPOffice/PHPExcel/blob/master/license.md)
|
|
@ -1,21 +0,0 @@
|
|||
;Configuration File made by Zend Studio PHPDocumentor Wizard, Wed Dec 20 15:14:29 CET 2006
|
||||
pear=on
|
||||
|
||||
filename=J:\_werk\PHPExcel\Working\Classes\PHPExcel.php
|
||||
|
||||
output=HTML:Smarty:PHP
|
||||
|
||||
parseprivate=on
|
||||
|
||||
directory=J:\_werk\PHPExcel\Working\Classes\PHPExcel
|
||||
|
||||
target=J:\_werk\PHPExcel\Working\Documentation\API\
|
||||
|
||||
defaultcategoryname=PHPExcel
|
||||
|
||||
title=PHPExcel classes
|
||||
|
||||
sourcecode=on
|
||||
|
||||
javadocdesc=on
|
||||
|
21
phpdoc.ini
21
phpdoc.ini
|
@ -1,21 +0,0 @@
|
|||
;Configuration File made by Zend Studio PHPDocumentor Wizard, Wed Dec 20 15:14:29 CET 2006
|
||||
pear=on
|
||||
|
||||
filename=F:\_werk\PHPExcel\Working\Classes\PHPExcel.php
|
||||
|
||||
output=HTML:Smarty:PHP
|
||||
|
||||
parseprivate=on
|
||||
|
||||
directory=F:\_werk\PHPExcel\Working\Classes\PHPExcel
|
||||
|
||||
target=F:\_werk\PHPExcel\Working\Documentation\API\
|
||||
|
||||
defaultcategoryname=PHPExcel
|
||||
|
||||
title=PHPExcel classes
|
||||
|
||||
sourcecode=on
|
||||
|
||||
javadocdesc=on
|
||||
|
36
readme.md
36
readme.md
|
@ -1,36 +0,0 @@
|
|||
# PHPExcel - OpenXML - Read, Write and Create spreadsheet documents in PHP - Spreadsheet engine
|
||||
PHPExcel is a library written in pure PHP and providing a set of classes that allow you to write to and read from different spreadsheet file formats, like Excel (BIFF) .xls, Excel 2007 (OfficeOpenXML) .xlsx, CSV, Libre/OpenOffice Calc .ods, Gnumeric, PDF, HTML, ... This project is built around Microsoft's OpenXML standard and PHP.
|
||||
|
||||
|
||||
## File Formats supported
|
||||
|
||||
### Reading
|
||||
* BIFF 5-8 (.xls) Excel 95 and above
|
||||
* Office Open XML (.xlsx) Excel 2007 and above
|
||||
* SpreadsheetML (.xml) Excel 2003
|
||||
* Open Document Format/OASIS (.ods)
|
||||
* Gnumeric
|
||||
* HTML
|
||||
* SYLK
|
||||
* CSV
|
||||
|
||||
### Writing
|
||||
* BIFF 8 (.xls) Excel 95 and above
|
||||
* Office Open XML (.xlsx) Excel 2007 and above
|
||||
* HTML
|
||||
* CSV
|
||||
* PDF (using either the tcPDF, DomPDF or mPDF libraries, which need to be installed separately)
|
||||
|
||||
|
||||
## Requirements
|
||||
* PHP version 5.2.0 or higher
|
||||
* PHP extension php_zip enabled (required if you need PHPExcel to handle .xlsx .ods or .gnumeric files)
|
||||
* PHP extension php_xml enabled
|
||||
* PHP extension php_gd2 enabled (optional, but required for exact column width autocalculation)
|
||||
|
||||
|
||||
## Want to contribute?
|
||||
Fork us!
|
||||
|
||||
## License
|
||||
PHPExcel is licensed under [LGPL (GNU LESSER GENERAL PUBLIC LICENSE)](https://github.com/PHPOffice/PHPExcel/blob/master/license.md)
|
|
@ -1,5 +0,0 @@
|
|||
@set PHPINSTALLDIR=C:\PHP\5.2.9
|
||||
@set PATH=%PHPINSTALLDIR%;%PATH%;
|
||||
|
||||
cd Tests
|
||||
cls
|
|
@ -1 +0,0 @@
|
|||
%comspec% /k setpath.bat
|
Loading…
Reference in New Issue