Skip to content

Commit

Permalink
prepare vanilla php
Browse files Browse the repository at this point in the history
  • Loading branch information
froger-me committed Jan 8, 2024
1 parent 590ce45 commit d21f813
Show file tree
Hide file tree
Showing 2 changed files with 418 additions and 0 deletions.
86 changes: 86 additions & 0 deletions integration/dummy-generic/dummy-generic.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?php

require_once dirname(__FILE__) . '/wppus-api.php';

$command = $argv[1] ?? '';
$license = $argv[2] ?? '';

switch ($command) {
case 'install':
if (!wppus_api_is_installed() && $license !== '') {
wppus_api_install($license);
echo "Installed\n";
exit(0);
} else {
echo "Failed to install\n";
exit(1);
}
break;

case 'uninstall':
if (wppus_api_is_installed()) {
wppus_api_uninstall();
echo "Uninstalled\n";
exit(0);
} else {
echo "Nothing to uninstall\n";
exit(1);
}
break;

case 'activate':
if (wppus_api_is_installed()) {
wppus_api_activate();
echo "Activated\n";
exit(0);
} else {
echo "The package is not installed\n";
exit(1);
}
break;

case 'deactivate':
if (wppus_api_is_installed()) {
wppus_api_deactivate();
echo "Deactivated\n";
exit(0);
} else {
echo "The package is not installed\n";
exit(1);
}
break;

case 'get_update_info':
if (wppus_api_is_installed()) {
wppus_api_get_update_info();
exit(0);
} else {
echo "The package is not installed\n";
exit(1);
}
break;

case 'update':
if (wppus_api_is_installed()) {
wppus_api_check_for_updates();
echo "Updated\n";
wppus_api_get_update_info();
exit(0);
} else {
echo "The package is not installed\n";
exit(1);
}
break;

default:
echo "Usage: php " . basename(__FILE__) . " [command] [arguments]\n";
echo "Commands:\n";
echo " install [license] - install the package\n";
echo " uninstall - uninstall the package\n";
echo " activate - activate the license\n";
echo " deactivate - deactivate the license\n";
echo " get_update_info - output information about the remote package update\n";
echo " update - update the package if available\n";
echo "Installing the package will register a cronjob that will check for updates every 12 hours, and will install the update if available.\n";
exit(1);
}
Loading

0 comments on commit d21f813

Please sign in to comment.