code: public function run40Update()
  	{
  		// Adjust the framework agnostic scripts
  		$this->Database->query("ALTER TABLE `tl_layout` ADD `scripts` text NULL");
  		$objLayout = $this->Database->query("SELECT id, addJQuery, jquery, addMooTools, mootools FROM tl_layout WHERE framework!=''");
  
  		while ($objLayout->next())
  		{
  			$arrScripts = array();
  
  			// Check whether j_slider is enabled
  			if ($objLayout->addJQuery)
  			{
  				$jquery = StringUtil::deserialize($objLayout->jquery);
  
  				if (!empty($jquery) && \is_array($jquery))
  				{
  					if (($key = array_search('j_slider', $jquery)) !== false)
  					{
  						$arrScripts[] = 'js_slider';
  						unset($jquery[$key]);
  
  						$this->Database->prepare("UPDATE tl_layout SET jquery=? WHERE id=?")
  									   ->execute(serialize(array_values($jquery)), $objLayout->id);
  					}
  				}
  			}
  
  			// Check whether moo_slider is enabled
  			if ($objLayout->addMooTools)
  			{
  				$mootools = StringUtil::deserialize($objLayout->mootools);
  
  				if (!empty($mootools) && \is_array($mootools))
  				{
  					if (($key = array_search('moo_slider', $mootools)) !== false)
  					{
  						$arrScripts[] = 'js_slider';
  						unset($mootools[$key]);
  
  						$this->Database->prepare("UPDATE tl_layout SET mootools=? WHERE id=?")
  									   ->execute(serialize(array_values($mootools)), $objLayout->id);
  					}
  				}
  			}
  
  			// Enable the js_slider template
  			if (!empty($arrScripts))
  			{
  				$this->Database->prepare("UPDATE tl_layout SET scripts=? WHERE id=?")
  							   ->execute(serialize(array_values(array_unique($arrScripts))), $objLayout->id);
  			}
  		}
  	}
docs: Version 4.0.0 update