/** * adds additional info to current session * @param String $action * @param DataObject $copyFrom * @param DataObject $copyInto */ protected static function add_to_session($action, $copyFrom = null, $copyInto = null) { $obj = new CopyFactoryLog(); $obj->Type = Config::inst()->get("CopyFactory", "for_real") ? "Real" : "Fake"; $obj->StartTime = Config::inst()->get("CopyFactory", "start_time"); $obj->CopyCausingClassName = Config::inst()->get("CopyFactory", "dry_run_for_class_name"); $obj->CopyCausingClassNameID = Config::inst()->get("CopyFactory", "dry_run_for_id"); if ($copyFrom) { $obj->CopyFromClassNameID = $copyFrom->ID; } if ($copyInto) { $obj->CopyIntoClassName = $copyInto->ClassName; $obj->CopyIntoClassNameID = $copyInto->ID; } $obj->Action = $action; $obj->write(); if (Config::inst()->get("CopyFactory", "debug")) { $copyFromLine = ""; if ($copyFrom && $copyFrom->exists()) { $copyFromLine = "FROM: " . self::title_for_object($copyFrom) . " - " . $copyFrom->ClassName . "." . $copyFrom->ID . "\n"; } $copyIntoLine = ""; if ($copyInto && $copyInto->exists()) { $copyIntoLine = "INTO: " . self::title_for_object($copyInto) . " - " . $copyInto->ClassName . "." . $copyInto->ID . "\n"; } debug::log($copyFromLine . $copyIntoLine . $action); } }