Les Partages de Memiks
Tag cloud
Picture wall
Daily
Plugins
  • ► Play Videos
RSS Feed
  • RSS Feed
  • Daily Feed
  • Weekly Feed
  • Monthly Feed
Filters

Links per page

  • 20 links
  • 50 links
  • 100 links

Filters

Untagged links
Comment créer un script php qui auto install une application ? /shaare/5wP54Q
Tue Aug 13 22:38:20 2013 archive.org
QRCode

1) créer un fichier install.php qui contient:

<?php
$zip_file = "install.zip";
$php_install_script = "install_zip.php";
$content;
if(file_exists($zip_file)) {
$content = base64_encode(file_get_contents($zip_file));
$install_script= '<?php
// assuming file.zip is in the same directory as the executing script.
$file = \'install.zip\';
$fp = fopen($file,\'wb\');
fwrite($fp,base64_decode(\''.$content.'\'));
fclose($fp);

$zip = new ZipArchive;
$res = $zip->open($file);
if ($res === TRUE) {
// extract it to the path we determined above
$zip->extractTo(\'.\');
$zip->close();
echo "WOOT! $file extracted to here";
} else {
echo "Doh! I couldn\'t open $file";
}
';

$fp = fopen($php_install_script,'wb');
fwrite($fp,$install_script);
fclose($fp);
echo "Creation of $php_install_script DONE !!";

} else {
echo "unable to found $zip_file";
}

(ou récupérer le fichier ici : http://shaarli.memiks.fr/snippets/install.txt)

2) mettre dans le même répertoire un fichier install.zip de votre application

3) lancer le fichier install.php

4) vous obtenez un fichier intall_zip.php qui va:

a) lors de l’exécution créer le fichier install.zip d'origine
b) l'extraire la ou est le fichier install_zip.php

voila ;)

@Seb je partage car tu nous fait partager tes "petits bouts de codes"

Attention il faut l'extension zip d'activer dans php...

Fréd.

zip auto install archive php code snippets
4242 links, including 1169 private
Shaarli - The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community - Theme by kalvn