예제 #1
0
	/**
	 * Checks the all data content tables of comprofiler fields and upgrades if needed
	 * Backend-use only.
	 * @access private
	 *
	 * @param  boolean         $upgrade    False: only check table, True: upgrades table (depending on $dryRun)
	 * @param  boolean         $dryRun     True: doesn't do the modifying queries, but lists them, False: does the job
	 * @return string                      Message to display
	 */
	function checkAllCBfieldsDb( $upgrade = false, $dryRun = false ) {
		cbimport( 'cb.sql.upgrader' );
		$this->_sqlUpgrader			=	new CBSQLupgrader( $this->_db, $this->_silentWhenOK );
		$this->_sqlUpgrader->setDryRun( $dryRun );

		$this->_db->setQuery( "SELECT f.*" 
//				f.fieldid, f.title, f.name, f.description, f.type, f.required, f.published, "
//			. "f.profile, f.ordering, f.registration, f.searchable, f.pluginid, f.sys, f.tablecolumns, "
//			. ", t.title AS 'tab', t.enabled AS 'tabenabled', t.pluginid AS 'tabpluginid', "
//			. "p.name AS pluginname, p.published AS pluginpublished, "
//			. "pf.name AS fieldpluginname, pf.published AS fieldpluginpublished "
			. "\n FROM #__comprofiler_fields AS f"
			. "\n INNER JOIN #__comprofiler_tabs AS t ON ( (f.tabid = t.tabid) AND (t.fields = 1) ) "
			. "\n LEFT JOIN #__comprofiler_plugin AS p ON p.id = t.pluginid"
			. "\n LEFT JOIN #__comprofiler_plugin AS pf ON pf.id = f.pluginid"
			. "\n ORDER BY t.ordering, f.ordering"
		);
	
		$rows = $this->_db->loadObjectList( 'fieldid', 'moscomprofilerFields', array( &$this->_db ) );
		if ( $this->_db->getErrorNum() ) {
			echo $this->_db->stderr();
			return false;
		}
		$ret						=	true;
		foreach ( $rows as $field ) {
			$fieldHandler			=	new cbFieldHandler();
			$success				=	$fieldHandler->checkFixSQL( $this->_sqlUpgrader, $field, $upgrade );
			if ( ! $success ) {
				$ret				=	false;
				// echo $field->_error;
			}
		}
		return $ret;
	}
 /**
  * Checks the all data content tables of comprofiler fields and upgrades if needed
  * Backend-use only.
  * @access private
  *
  * @param  boolean         $upgrade    False: only check table, True: upgrades table (depending on $dryRun)
  * @param  boolean         $dryRun     True: doesn't do the modifying queries, but lists them, False: does the job
  * @return string                      Message to display
  */
 function checkAllCBfieldsDb($upgrade = false, $dryRun = false)
 {
     cbimport('cb.sql.upgrader');
     $this->_sqlUpgrader = new CBSQLupgrader($this->_db, $this->_silentWhenOK);
     $this->_sqlUpgrader->setDryRun($dryRun);
     $this->_db->setQuery("SELECT f.*" . "\n FROM #__comprofiler_fields AS f" . "\n INNER JOIN #__comprofiler_tabs AS t ON ( (f.tabid = t.tabid) AND (t.fields = 1) ) " . "\n LEFT JOIN #__comprofiler_plugin AS p ON p.id = t.pluginid" . "\n LEFT JOIN #__comprofiler_plugin AS pf ON pf.id = f.pluginid" . "\n ORDER BY t.ordering, f.ordering");
     $rows = $this->_db->loadObjectList('fieldid', 'moscomprofilerFields', array(&$this->_db));
     if ($this->_db->getErrorNum()) {
         echo $this->_db->stderr();
         return false;
     }
     $ret = true;
     foreach ($rows as $field) {
         $fieldHandler = new cbFieldHandler();
         $success = $fieldHandler->checkFixSQL($this->_sqlUpgrader, $field, $upgrade);
         if (!$success) {
             $ret = false;
             // echo $field->_error;
         }
     }
     return $ret;
 }