<commit_before><?php

	Class extension_datetime extends Extension {

		/**
		 * Extension information
		 */

		public function about() {
			return array(
				'name' => 'Field: Date and Time',
				'version' => '1.3dev',
				'release-date' => 'unreleased',
				'author' => array(
					'name' => '<NAME>',
					'website' => 'http://www.nilshoerrmann.de',
					'email' => '<EMAIL>'
				)
			);
		}

		/**
		 * Add callback functions to backend delegates
		 */

		public function getSubscribedDelegates(){
			return array(
				array(
					'page' => '/backend/',
					'delegate' => 'InitaliseAdminPageHead',
					'callback' => '__addDateJS'
				)
			);
		}

		/**
		 * Add international dateJS
		 */

		public function __addDateJS() {
			// get current language
			$lang = Administration::instance()->Configuration->get('lang', 'symphony');
			// check dateJS language
			if(file_exists(EXTENSIONS . '/datetime/assets/international/datejs.' . $lang . '.js')) {
				Administration::instance()->Page->addScriptToHead(URL . '/extensions/datetime/assets/international/datejs.' . $lang . '.js', 200, false);
			}
			else {
				Administration::instance()->Page->addScriptToHead(URL . '/extensions/datetime/assets/international/datejs.en.js', 200, false);
			}
		}

		/**
		 * Function to be executed on uninstallation
		 */

		public function uninstall() {
			// drop database table
			Administration::instance()->Database->query("DROP TABLE `tbl_fields_datetime`");
		}

		/**
		 * Function to be executed if the extension has been updated
		 *
		 * @param string $previousVersion - version number of the currently installed extension build
		 * @return boolean - true on success, false otherwise
		 */

		public function update($previousVersion) {
			/*	Go through all the existing datetime tables converting the start/end to datetime */
			if(version_compare($previousVersion, '1.3', '<')){
				$fields = $this->_Parent->Database->query("ALTER TABLE `tbl_fields_datetime` MODIFY 'end' DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', MODIFY 'start' DATETIME NOT NULL '0000-00-00 00:00:00'");
			}

			return true;<commit_msg>Update SQL for Versions previous to 1.3<commit_after><?php

	Class extension_datetime extends Extension {

		/**
		 * Extension information
		 */

		public function about() {
			return array(
				'name' => 'Field: Date and Time',
				'version' => '1.3dev',
				'release-date' => 'unreleased',
				'author' => array(
					'name' => '<NAME>',
					'website' => 'http://www.nilshoerrmann.de',
					'email' => '<EMAIL>'
				)
			);
		}

		/**
		 * Add callback functions to backend delegates
		 */

		public function getSubscribedDelegates(){
			return array(
				array(
					'page' => '/backend/',
					'delegate' => 'InitaliseAdminPageHead',
					'callback' => '__addDateJS'
				)
			);
		}

		/**
		 * Add international dateJS
		 */

		public function __addDateJS() {
			// get current language
			$lang = Administration::instance()->Configuration->get('lang', 'symphony');
			// check dateJS language
			if(file_exists(EXTENSIONS . '/datetime/assets/international/datejs.' . $lang . '.js')) {
				Administration::instance()->Page->addScriptToHead(URL . '/extensions/datetime/assets/international/datejs.' . $lang . '.js', 200, false);
			}
			else {
				Administration::instance()->Page->addScriptToHead(URL . '/extensions/datetime/assets/international/datejs.en.js', 200, false);
			}
		}

		/**
		 * Function to be executed on uninstallation
		 */

		public function uninstall() {
			// drop database table
			Administration::instance()->Database->query("DROP TABLE `tbl_fields_datetime`");
		}

		/**
		 * Function to be executed if the extension has been updated
		 *
		 * @param string $previousVersion - version number of the currently installed extension build
		 * @return boolean - true on success, false otherwise
		 */

		public function update($previousVersion) {
			/*	Go through all the existing datetime tables converting the start/end to datetime */
			if(version_compare($previousVersion, '1.3', '<')){
				$fields = Administration::instance()->Database->fetchCol("field_id", "SELECT `field_id` from `tbl_fields_datetime`");

				foreach($fields as $field) {
					Administration::instance()->Database->query(
								sprintf("
									ALTER TABLE `tbl_entries_data_%d`
									MODIFY `end` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
									MODIFY `start` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'
								", $field)
							)
					);
				}
			}

			return true;
{'fraction_non_alphanumeric': 0.14947882013750277, 'fraction_numerical': 0.017298735861610112, 'mean_word_length': 3.172062904717854, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 50, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2600609', 'n_tokens_mistral': 1710, 'n_tokens_neox': 1302, 'n_words': 333}