<commit_before><?php
/**
 * DisplayAnythingGalleryField()
 * @note provides a gallery conifigration and viewer field in the CMS for a DisplayAnythingGallery
 */
class DisplayAnythingGalleryField extends UploadAnythingField {
	
	protected $itemsClass;
	
	protected $detect_image_gallery_module = TRUE;
	
	public function __construct($controller, $name, $sourceClass, $itemsClass = "GalleryItems", $fieldList = null, $detailFormFields = null, $sourceFilter = "", $sourceSort = "", $sourceJoin = "") {
		parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);
		$this->itemsClass = $itemsClass;
		$this->SetMimeTypes();
	}

	/**
	 * ImageGalleryAlbums()
	 * @note gets ImageGalleryAlbum records for the current page
	 * @note we don't use the ORM here as the image_gallery module may no longer exist in the code base
	 * @returns array
	 */
	protected function ImageGalleryAlbums() {
		$list = array();
		if (!class_exists('ImageGalleryAlbum')) {
			return $list;
		}
		if($id = $this->controller->ID) {
			$sql = "SELECT a.*, COUNT(i.ID) AS ItemCount FROM ImageGalleryAlbum a"
				. " LEFT JOIN ImageGalleryItem i ON i.AlbumID = a.ID"
				. " WHERE a.ImageGalleryPageID = {$id}";
			if($results = DB::Query($sql)) {
				foreach($results as $record) {
					if(!empty($record['ID'])) {
						$list[$record['ID']] = "  " . $record['AlbumName'] . " - {$record['ItemCount']} image(s)";
					}
				}<commit_msg>remove ImageGalleryAlbum class test: fix regression if the ImageGalleryAlbum class was removed but the database tables you want to migrate images out of still exist<commit_after><?php
/**
 * DisplayAnythingGalleryField()
 * @note provides a gallery conifigration and viewer field in the CMS for a DisplayAnythingGallery
 */
class DisplayAnythingGalleryField extends UploadAnythingField {
	
	protected $itemsClass;
	
	protected $detect_image_gallery_module = TRUE;
	
	public function __construct($controller, $name, $sourceClass, $itemsClass = "GalleryItems", $fieldList = null, $detailFormFields = null, $sourceFilter = "", $sourceSort = "", $sourceJoin = "") {
		parent::__construct($controller, $name, $sourceClass, $fieldList, $detailFormFields, $sourceFilter, $sourceSort, $sourceJoin);
		$this->itemsClass = $itemsClass;
		$this->SetMimeTypes();
	}

	/**
	 * ImageGalleryAlbums()
	 * @note gets ImageGalleryAlbum records for the current page
	 * @note we don't use the ORM here as the image_gallery module may no longer exist in the code base
	 * @returns array
	 */
	protected function ImageGalleryAlbums() {
		$list = array();
		
		if($id = $this->controller->ID) {
			$sql = "SELECT a.*, COUNT(i.ID) AS ItemCount FROM ImageGalleryAlbum a"
				. " LEFT JOIN ImageGalleryItem i ON i.AlbumID = a.ID"
				. " WHERE a.ImageGalleryPageID = {$id}";
			if($results = DB::Query($sql)) {
				foreach($results as $record) {
					if(!empty($record['ID'])) {
						$list[$record['ID']] = "  " . $record['AlbumName'] . " - {$record['ItemCount']} image(s)";
					}
				}
{'fraction_non_alphanumeric': 0.13895291405992757, 'fraction_numerical': 0.0, 'mean_word_length': 4.493670886075949, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '402433', 'n_tokens_mistral': 1041, 'n_tokens_neox': 899, 'n_words': 260}