<commit_before><?php

namespace wcf\system\importer;

use wcf\data\media\Media;
use wcf\data\media\MediaAction;
use wcf\data\media\MediaEditor;
use wcf\system\exception\SystemException;
use wcf\system\language\LanguageFactory;
use wcf\system\upload\DefaultUploadFileSaveStrategy;
use wcf\system\WCF;

/**
 * Imports cms media.
 *
 * @author  <NAME>
 * @copyright   2001-2019 WoltLab GmbH
 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package WoltLabSuite\Core\System\Importer
 */
class MediaImporter extends AbstractImporter
{
    /**
     * @inheritDoc
     */
    protected $className = Media::class;

    /**
     * @var DefaultUploadFileSaveStrategy
     */
    private $saveStrategy;

    /**
     * @inheritDoc
     */
    public function import($oldID, array $data, array $additionalData = [])
    {
        $data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']);

        $contents = [];
        if (!empty($additionalData['contents'])) {
            foreach ($additionalData['contents'] as $languageCode => $contentData) {
                $languageID = 0;
                if (!$languageCode) {<commit_msg>Check whether the media file is readable in MediaImporter<commit_after><?php

namespace wcf\system\importer;

use wcf\data\media\Media;
use wcf\data\media\MediaAction;
use wcf\data\media\MediaEditor;
use wcf\system\exception\SystemException;
use wcf\system\language\LanguageFactory;
use wcf\system\upload\DefaultUploadFileSaveStrategy;
use wcf\system\WCF;

/**
 * Imports cms media.
 *
 * @author  <NAME>
 * @copyright   2001-2021 WoltLab GmbH
 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package WoltLabSuite\Core\System\Importer
 */
class MediaImporter extends AbstractImporter
{
    /**
     * @inheritDoc
     */
    protected $className = Media::class;

    /**
     * @var DefaultUploadFileSaveStrategy
     */
    private $saveStrategy;

    /**
     * @inheritDoc
     */
    public function import($oldID, array $data, array $additionalData = [])
    {
        // check file location
        if (!\is_readable($additionalData['fileLocation'])) {
            return 0;
        }

        $data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']);

        $contents = [];
        if (!empty($additionalData['contents'])) {
            foreach ($additionalData['contents'] as $languageCode => $contentData) {
                $languageID = 0;
                if (!$languageCode) {
{'fraction_non_alphanumeric': 0.13657407407407407, 'fraction_numerical': 0.0073302469135802465, 'mean_word_length': 3.0963665086887837, 'pattern_counts': {'":': 0, '<': 9, '<?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': '1694177', 'n_tokens_mistral': 802, 'n_tokens_neox': 765, 'n_words': 155}