-
-
Save brianteeman/4abe00a741d4c2b869bb1293fb26595d to your computer and use it in GitHub Desktop.
CLI script to unpublish classes from samuel taylor web site
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @package Joomla.Cli | |
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved. | |
* @license GNU General Public License version 2 or later; see LICENSE.txt | |
* | |
* CLI script to unpublish classes from samuel taylor web site | |
* Put this script in the /cli folder | |
* Execute by php <path_to_your_joomla_root>/cli/coursesexpired.php | |
*/ | |
// Set flag that this is a parent file. | |
const _JEXEC = 1; | |
error_reporting(E_ALL | E_NOTICE); | |
ini_set('display_errors', 1); | |
// Load system defines | |
if (file_exists(dirname(__DIR__) . '/defines.php')) | |
{ | |
require_once dirname(__DIR__) . '/defines.php'; | |
} | |
if (!defined('_JDEFINES')) | |
{ | |
define('JPATH_BASE', dirname(__DIR__)); | |
require_once JPATH_BASE . '/includes/defines.php'; | |
} | |
require_once JPATH_LIBRARIES . '/import.legacy.php'; | |
require_once JPATH_LIBRARIES . '/cms.php'; | |
/** | |
* @package Joomla.CLI | |
* @since 3.0 | |
*/ | |
class CoursesExpired extends JApplicationCli | |
{ | |
/** | |
* Entry point for CLI script | |
* | |
* @return void | |
* | |
* @since 3.0 | |
*/ | |
public function doExecute() | |
{ | |
// Database connector | |
$db = JFactory::getDBO(); | |
*/ | |
* Raw query | |
* UPDATE #__content | |
* INNER JOIN #__fields_values ON #__content.id = #__fields_values.item_id | |
* SET #__content.state = "0" | |
* WHERE #__fields_values.field_id = "11" | |
* AND VALUE <= NOW(); | |
*/ | |
// Set SQL query | |
$query = "SELECT COUNT(*) from #__users"; | |
// Execute query | |
$db->setQuery($query); | |
} | |
} | |
// Instantiate the application object, passing the class name to JCli::getInstance | |
// and use chaining to execute the application. | |
JApplicationCli::getInstance('CoursesExpired')->execute(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment