LEGACY LEGACY LEGACY
190890
function legacySync (peer) {
    if(!legacy) return

    var drain //we need to keep a reference to drain
              //so we can abort it when we get an error.
    function hasLegacy (hashes) {
      var ary = Object.keys(hashes).filter(function (k) {
        return hashes[k] < 0
      })
      if(ary.length)
        peer.blobs.has(ary, function (err, haves) {
          if(err) drain.abort(err) //ERROR: abort this stream.
          else haves.forEach(function (have, i) {
            if(have) has(peer.id, ary[i], have)
          })
        })
    }

    function notPeer (err) {
      if(err) dead(peer.id)
    }

    drain = pull.drain(function (hash) {
      has(peer.id, hash, true)
    }, notPeer)


    pull(peer.blobs.changes(), drain)

    hasLegacy(want)

    //a stream of hashes
    pull(notify.listen(), pull.drain(hasLegacy, notPeer))
  }
350933
public function buildLegacyKernel($legacyKernelHandler)
    {
        $legacyRootDir = $this->legacyRootDir;
        $webrootDir = $this->webrootDir;
        $eventDispatcher = $this->eventDispatcher;
        $logger = $this->logger;
        $that = $this;

        return static function () use ($legacyKernelHandler, $legacyRootDir, $webrootDir, $eventDispatcher, $logger, $that) {
            if (LegacyKernel::hasInstance()) {
                return LegacyKernel::instance();
            }

            if ($legacyKernelHandler instanceof \Closure) {
                $legacyKernelHandler = $legacyKernelHandler();
            }
            $legacyKernel = new LegacyKernel($legacyKernelHandler, $legacyRootDir, $webrootDir, $logger);

            if ($that->getBuildEventsEnabled()) {
                $eventDispatcher->dispatch(
                    LegacyEvents::POST_BUILD_LEGACY_KERNEL,
                    new PostBuildKernelEvent($legacyKernel, $legacyKernelHandler)
                );
            }

            return $legacyKernel;
        };
    }
347683
def _legacy_index() -> Union[None, Dict[str, str]]:
    
    for index in _LEGACY_INDICES:
        if index.exists():
            try:
                return json.load(open(index))
            except (OSError, json.JSONDecodeError):
                return None
    return None
1257109
protected function get_legacy_eventdata() {
        $eventdata = new \stdClass();
        $eventdata->modulename = 'assign';
        $eventdata->cmid = $this->contextinstanceid;
        $eventdata->itemid = $this->objectid;
        $eventdata->courseid = $this->courseid;
        $eventdata->userid = $this->userid;
        if (count($this->legacyfiles) > 1) {
            $eventdata->files = $this->legacyfiles;
        }
        $eventdata->file = $this->legacyfiles;
        $eventdata->pathnamehashes = array_keys($this->legacyfiles);
        return $eventdata;
    }
466700
function (src, destId, next, parent) {
            var oldId = src.id;
            src.parent = destId;

            async.waterfall([
                async.apply(_getAncestorsFromImmediateParent, destId, parent),
                function saveNodesAncestors(newAncestors, next) {
                    src.ancestors = newAncestors;
                    src._id = new ObjectId();
                    pendingInsertNodes.push(src);
                    async.parallel([
                            function findContentEntries(next) {
                                contentModel.find({"meta.node": oldId}).exec(function (err, data) {
                                    if (err) {
                                        next(err);
                                    }
                                    else {
                                        next(null, data);
                                    }
                                });
                            },
                            function findNodeEntries(next) {
                                nodeModel.find({parent: oldId}).exec(function (err, data) {
                                    if (err) {
                                        next(err);
                                    }
                                    else {
                                        next(null, data);
                                    }
                                });
                            }
                        ],
                        function handleFoundContentAndNodes(err, data) {
                            var contentEntries = data[0], nodeEntries = data[1];
                            _.each(contentEntries, function (item) {
                                item.meta.node = src._id;
                                item._id = new ObjectId();
                                pendingInsertContent.push(item);
                            });
                            if (!nodeEntries.length) {
                                next();
                            }
                            else {
                                async.each(nodeEntries, function (item, next) {
                                    _recursiveCopyNodes(item, src._id, next, src);
                                }, function (err) {
                                    next(err);
                                });
                            }
                        });

                }
            ], function (err) {
                next(err);
            });
        }
1292943
protected function get_legacy_eventdata() {
        $legacyeventdata = $this->get_record_snapshot('user_enrolments', $this->objectid);
        $legacyeventdata->enrol = $this->other['enrol'];
        $legacyeventdata->courseid = $this->courseid;
        return $legacyeventdata;
    }
128631
def install_user_command_legacy(command, **substitutions):
    '''
    '''
    path = flo('~/bin/{command}')
    install_file_legacy(path, **substitutions)
    run(flo('chmod 755 {path}'))
693971
protected function get_legacy_logdata() {
        $chapter = $this->get_record_snapshot('book_chapters', $this->objectid);
        return array($this->courseid, 'book', 'update', 'view.php?id='.$this->contextinstanceid, $chapter->bookid, $this->contextinstanceid);
    }
902294
def create_legacy_graph_tasks():
  """"""
  return [
    transitive_hydrated_targets,
    transitive_hydrated_target,
    hydrated_targets,
    hydrate_target,
    find_owners,
    hydrate_sources,
    hydrate_bundles,
    RootRule(OwnersRequest),
  ]
1290077
function (params, cb) {
                  DB.getCardState(params.cardKey, params.legacyCardKey, function (err, state) {
                    cb(null, params, state);
                  });
                }
293732
public function from_legacy_event_to_data(\calendar_event $legacyevent) {
        $legacyevent->count_repeats();
        $data = $legacyevent->properties();
        $data->timedurationuntil = $legacyevent->timestart + $legacyevent->timeduration;
        $data->duration = (empty($legacyevent->timeduration)) ? 0 : 1;

        if ($legacyevent->eventtype == 'group') {
            // Set up the correct value for the to display on the form.
            $data->groupid = $legacyevent->groupid;
            $data->groupcourseid = $legacyevent->courseid;
        }
        if ($legacyevent->eventtype == 'course') {
            // Set up the correct value for the to display on the form.
            $data->courseid = $legacyevent->courseid;
        }
        $data->description = [
            'text' => $data->description,
            'format' => $data->format
        ];

        // We don't want to return the context because it's not a
        // form value and breaks the validation.
        if (isset($data->context)) {
            unset($data->context);
        }

        return $data;
    }
641166
function( data, url ){
        return (
            data.type &&
            "legacy-image-pyramid" == data.type
        ) || (
            data.documentElement &&
            "legacy-image-pyramid" == data.documentElement.getAttribute('type')
        );
    }
847340
def handle_activity_legacy(_: str, __: int, tokens: ParseResults) -> ParseResults:
    """"""
    legacy_cls = language.activity_labels[tokens[MODIFIER]]
    tokens[MODIFIER] = ACTIVITY
    tokens[EFFECT] = {
        NAME: legacy_cls,
        NAMESPACE: BEL_DEFAULT_NAMESPACE
    }
    log.log(5, 'upgraded legacy activity to %s', legacy_cls)
    return tokens
1328412
function normalizeProductionRightSide (p, forceObjects) {
  
  if(p.hasOwnProperty('successors')) {
    for (var i = 0; i < p.successors.length; i++) {
      p.successors[i] = normalizeProductionRightSide(p.successors[i], forceObjects);
    }

  } else if(p.hasOwnProperty('successor') === false){
    p = { successor: p };
  }
  
  if(forceObjects && p.hasOwnProperty('successor')) {
    p.successor = stringToObjects(p.successor);
  }
  
  return p;
}
37881
protected function get_legacy_logdata() {
        $legacylogdata = array($this->courseid,
            'choice',
            'choose',
            'view.php?id=' . $this->contextinstanceid,
            $this->other['choiceid'],
            $this->contextinstanceid);

        return $legacylogdata;
    }
1268089
public function reparent($oldParentId, $newParentId)
    {
        /** @var $query \eZ\Publish\Core\Persistence\Database\UpdateQuery */
        $query = $this->dbHandler->createUpdateQuery();
        $query->update(
            $this->dbHandler->quoteTable($this->table)
        )->set(
            $this->dbHandler->quoteColumn('parent'),
            $query->bindValue($newParentId, null, \PDO::PARAM_INT)
        )->where(
            $query->expr->lAnd(
                $query->expr->eq(
                    $this->dbHandler->quoteColumn('is_alias'),
                    $query->bindValue(0, null, \PDO::PARAM_INT)
                ),
                $query->expr->eq(
                    $this->dbHandler->quoteColumn('parent'),
                    $query->bindValue($oldParentId, null, \PDO::PARAM_INT)
                )
            )
        );

        $query->prepare()->execute();
    }
1318748
def _fusion_legacy_handler(_, __, tokens):
    """"""
    if RANGE_5P not in tokens:
        tokens[RANGE_5P] = {FUSION_MISSING: '?'}
    if RANGE_3P not in tokens:
        tokens[RANGE_3P] = {FUSION_MISSING: '?'}
    return tokens