HEX
Server: Apache/2.4.41
System: Linux mainweb 5.4.0-182-generic #202-Ubuntu SMP Fri Apr 26 12:29:36 UTC 2024 x86_64
User: nationalmedicaregrp (1119)
PHP: 8.3.7
Disabled: exec,passthru,shell_exec,system,popen,proc_open,pcntl_exec
Upload Files
File: /home/flbestac/public_html/wp-content/plugins/wp-seopress/src/Models/Table/TableColumn.php
<?php

namespace SEOPress\Models\Table;

defined( 'ABSPATH' ) || exit;

use SEOPress\Models\Table\TableColumnInterface;

class TableColumn implements TableColumnInterface {


    protected $name;

    protected $type;

    protected $primaryKey;

    protected $index;

    protected $defaultValue;

    public function __construct($name, $data = []){

        $this->name = $name;
        $this->type = isset($data['type']) ? $data['type'] : 'varchar';
        $this->primaryKey = isset($data['primaryKey']) ? (bool) $data['primaryKey'] : false;
        $this->index = isset($data['index']) ? $data['index'] : false;
    }

	public function getType(){
		if($this->type !== "datetime"){
			return $this->type;
		}

		if($this->defaultValue !== "CURRENT_TIMESTAMP"){
			return $this->type;
		}

		global $wpdb;
		$server = $wpdb->get_var( 'SELECT VERSION()' );

		// Compatibility DB version < 5.6.5 don't support CURRENT_TIMESTAMP
		if(version_compare($server, '5.6.5', '<')){
			return 'timestamp';
		}

        return $this->type;
    }

	/**
	 * @return string
	 */
	public function getName(){
        return $this->name;
    }

    /**
     * @return bool
     */
	public function getPrimaryKey(){
        return $this->primaryKey;
    }

    public function getIndex(){
        return $this->index;
    }


}