/pssc.inc.php

Description

Functions for use in scripts

PSSC - PHP Sysadmin Script Collection, a collection of (somewhat) usefull scripts for a sysadmin, written in PHP. Copyright (C) 2005 Richard Hinkamp

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 2 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, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

For full terms see the file COPYING. The license can also be found at: http://www.gnu.org/licenses/gpl.txt

Includes
require ($dir.'config.inc.php') (line 53)

Get config

Variables
array $CONFIG (line 45)

Config array

string $VERSION (line 39)

PSSC version number

Functions
BackupFile (line 91)

Backup a file, copy it to all backup dirs

  • access: public
void BackupFile (string $iFile, string $iDir)
  • string $iFile: Filename of the file to backup (will be deleted)
  • string $iDir: Directory to put it in
CheckDir (line 61)

Check if a dir exists in all backup dirs, if not, create it

  • access: public
void CheckDir (string $iDir)
  • string $iDir: Directory name
ConfigBackupsDirs (line 340)

Get config setting backups dirs

  • return: Array of backup directories to save to
  • access: public
array ConfigBackupsDirs ()
ConfigCvsCache (line 362)

Get config setting cvs cache location

  • return: CVS cache location
  • access: public
string ConfigCvsCache ()
ConfigCvsIgnore (line 373)

Get config setting cvs ignored projects

  • return: Array of projects to ignore
  • access: public
array ConfigCvsIgnore ()
ConfigCvsRepository (line 351)

Get config setting cvs repository location

  • return: CVS repository location
  • access: public
string ConfigCvsRepository ()
ConfigDirDestination (line 385)

Get config setting dir backup destination directory

  • return: Destination directory
  • access: public
string ConfigDirDestination (string $iDir)
  • string $iDir: Directory to get setting for
ConfigDirIgnoreNormal (line 397)

Get config setting dir backup ignores

  • return: Array of entries to ignore
  • access: public
array ConfigDirIgnoreNormal (string $iDir)
  • string $iDir: Directory to get setting for
ConfigDirIgnoreWildcard (line 413)

Get config setting dir backup ignores

  • return: Array of wildcards to ignore
  • access: public
array ConfigDirIgnoreWildcard (string $iDir)
  • string $iDir: Directory to get setting for
ConfigErrorfile (line 299)

Get config setting error file

  • return: Location of error file
  • access: public
string ConfigErrorfile ()
ConfigLogfile (line 288)

Get config setting log file

  • return: Location of log file
  • access: public
string ConfigLogfile ()
ConfigMysqlPassword (line 439)

Get config setting mysql password

  • return: MySQL password
  • access: public
string ConfigMysqlPassword ()
ConfigMysqlUsername (line 428)

Get config setting mysql username

  • return: MySQL username
  • access: public
string ConfigMysqlUsername ()
ConfigOwnerGroup (line 325)

Get config setting owner group

  • return: Groupname for owner set
  • access: public
string ConfigOwnerGroup ()
ConfigOwnerUser (line 310)

Get config setting owner user

  • return: Username for owner set, or empty string
  • access: public
string ConfigOwnerUser ()
ConfigTempDir (line 277)

Get config setting for tmpdir

  • return: Temp dir
  • access: public
string ConfigTempDir ()
ConfigVerbose (line 255)

Get config setting for verbose

  • return: On or off
  • access: public
boolean ConfigVerbose ()
ConfigVerboseExecute (line 266)

Get config setting for verbose execute

  • return: On or off
  • access: public
boolean ConfigVerboseExecute ()
Done (line 180)

When a script is done, write it to log

  • access: public
void Done ()
Error (line 227)

Print a error message and also put it in error log, then exit

  • access: public
void Error (string $iMsg)
  • string $iMsg: Error message
Execute (line 146)

Execute a shell command

  • return: The return value of the shell command
  • access: public
int Execute (string $iCommand, [boolean $iIgnoreReturn = false])
  • string $iCommand: Shell command
  • boolean $iIgnoreReturn: Should it return a not 0 return value? eg when doing a diff
mkdirr (line 536)

Recursive mkdir

  • return: Did it work?
  • access: public
boolean mkdirr (string $pathname, [int $mode = 0755])
  • string $pathname: Directory to create
  • int $mode: Mode of the directory
Output (line 213)

Print a string if verbose output is on

  • access: public
void Output (string $iStr)
  • string $iStr: The string to output
RemoveBackupFile (line 124)

Remove a backup a file from all backup dirs

  • access: public
void RemoveBackupFile (string $iFile, string $iDir)
  • string $iFile: Filename of the file to be deleted
  • string $iDir: Directory it is in
rmdirr (line 572)

Recursive rmdir, so directory including all it's contents

  • return: Did it work?
  • access: public
boolean rmdirr (string $pathname)
  • string $pathname: Directory to remove
Run (line 169)

Function for simple run scripts

  • access: public
void Run (string $iCommand)
  • string $iCommand: Command to execute

Documentation generated on Tue, 12 Apr 2005 10:06:10 +0200 by phpDocumentor 1.3.0RC3